From c75478ddb1efab63b451c2b1ef31050a2de6d8c0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 19 Feb 2020 16:46:17 +0800 Subject: [PATCH 001/260] APL --- .../20200126 Use Vim to send email and check your calendar.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200126 Use Vim to send email and check your calendar.md b/sources/tech/20200126 Use Vim to send email and check your calendar.md index fdb709aaef..e8df90f319 100644 --- a/sources/tech/20200126 Use Vim to send email and check your calendar.md +++ b/sources/tech/20200126 Use Vim to send email and check your calendar.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4dba1925d9220967b27f5764ab7c2b5a636c3bf7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 19 Feb 2020 18:35:43 +0800 Subject: [PATCH 002/260] TSL --- ...m to send email and check your calendar.md | 117 ------------------ ...m to send email and check your calendar.md | 113 +++++++++++++++++ 2 files changed, 113 insertions(+), 117 deletions(-) delete mode 100644 sources/tech/20200126 Use Vim to send email and check your calendar.md create mode 100644 translated/tech/20200126 Use Vim to send email and check your calendar.md diff --git a/sources/tech/20200126 Use Vim to send email and check your calendar.md b/sources/tech/20200126 Use Vim to send email and check your calendar.md deleted file mode 100644 index e8df90f319..0000000000 --- a/sources/tech/20200126 Use Vim to send email and check your calendar.md +++ /dev/null @@ -1,117 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use Vim to send email and check your calendar) -[#]: via: (https://opensource.com/article/20/1/vim-email-calendar) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Use Vim to send email and check your calendar -====== -Manage your email and calendar right from your text editor in the -sixteenth in our series on 20 ways to be more productive with open -source in 2020. -![Calendar close up snapshot][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Doing (almost) all the things with Vim, part 1 - -I use two text editors regularly—[Vim][2] and [Emacs][3]. Why both? They have different use cases, and I'll talk about some of them in the next few articles in this series. - -![][4] - -OK, so why do everything in Vim? Because if there is one application that is on every machine I have access to, it's Vim. And if you are like me, you probably already spend a lot of time in Vim. So why not use it for _all the things_? - -Before that, though, you need to do some things. The first is to make sure you have Ruby support in Vim. You can check that with **vim --version | grep ruby**. If the result is not **+ruby**, that needs to be fixed. This can be tricky, and you should check your distribution's documentation for the right package to install. On MacOS, this is the official MacVim (not from Brew), and on most Linux distributions, this is either vim-nox or vim-gtk—NOT vim-gtk3. - -I use [Pathogen][5] to autoload my plugins and bundles. If you use [Vundle][6] or another Vim package manager, you'll need to adjust the commands below to work with it. - -#### Do your email in Vim - -A good starting place for making Vim a bigger part of your productivity plan is using it to send and receive email with [Notmuch][7] using [abook][8] to access your contact list. You need to install some things for this. All the sample code below is on Ubuntu, so you'll need to adjust for that if you are using a different distribution. Do the setup with: - - -``` -sudo apt install notmuch-vim ruby-mail -curl -o ~/.vim/plugin/abook --create-dirs -``` - -So far, so good. Now start Vim and execute **:NotMuch**. There may be some warnings due to the older version of the mail library **notmuch-vim** was written for, but in general, Vim will now be a full-featured Notmuch mail client. - -![Reading Mail in Vim][9] - -If you want to perform a search for a specific tag, type **\t**, enter the name of the tag, and press Enter. This will pull up a list of all messages with that tag. The **\s** key combination brings up a **Search:** prompt that will do a full search of the Notmuch database. Navigate the message list with the arrow keys, press Enter to display the selected item, and enter **\q** to exit the current view. - -To compose mail, use the **\c** keystroke. You will see a blank message. This is where the **abook.vim** plugin comes in. Hit **Esc** and enter **:AbookQuery <SomeName>**, where <SomeName> is a part of the name or email address you want to look for. You will get a list of entries in the abook database that match your search. Select the address you want by typing its number to add it to the email's address line. Finish typing and editing the email, press **Esc** to exit edit mode, and enter **,s** to send. - -If you want to change the default folder view when **:NotMuch** starts up, you can add the variable **g:notmuch_folders** to your **.vimrc** file: - - -``` -let g:notmuch_folders = [ -      \ [ 'new', 'tag:inbox and tag:unread' ], -      \ [ 'inbox', 'tag:inbox' ], -      \ [ 'unread', 'tag:unread' ], -      \ [ 'News', 'tag:@sanenews' ], -      \ [ 'Later', 'tag:@sanelater' ], -      \ [ 'Patreon', 'tag:@patreon' ], -      \ [ 'LivestockConservancy', 'tag:livestock-conservancy' ], -    \ ] -``` - -There are many more settings covered in the Notmuch plugin's documentation, including setting up keys for tags and using alternate mail programs. - -#### Consult your calendar in Vim - -![][10] - -Sadly, there do not appear to be any calendar programs for Vim that use the vCalendar or iCalendar formats. There is [Calendar.vim][11], which is very well done. Set up Vim to access your calendar with: - - -``` -cd ~/.vim/bundle -git clone [git@github.com][12]:itchyny/calendar.vim.git -``` - -Now, you can see your calendar in Vim by entering **:Calendar**. You can switch between year, month, week, day, and clock views with the **<** and **>** keys. If you want to start with a particular view, use the **-view=** flag to tell it which one you wish to see. You can also add a date to any of the views. For example, if I want to see what is going on the week of July 4, 2020, I would enter **:Calendar -view week 7 4 2020**. The help is pretty good and can be accessed with the **?** key. - -![][13] - -Calendar.vim also supports Google Calendar (which I need), but in December 2019 Google disabled the access for it. The author has posted a workaround in [the issue on -GitHub][14]. - -So there you have it, your mail, addresses, and calendars in Vim. But you aren't done yet; you'll do even more with Vim tomorrow! - -Vim offers great benefits to writers, regardless of whether they are technically minded or not. - -Need to keep your schedule straight? Learn how to do it using open source with these free... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/vim-email-calendar - -作者:[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 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) -[2]: https://www.vim.org/ -[3]: https://www.gnu.org/software/emacs/ -[4]: https://opensource.com/sites/default/files/uploads/day16-image1.png -[5]: https://github.com/tpope/vim-pathogen -[6]: https://github.com/VundleVim/Vundle.vim -[7]: https://opensource.com/article/20/1/organize-email-notmuch -[8]: https://opensource.com/article/20/1/sync-contacts-locally -[9]: https://opensource.com/sites/default/files/uploads/productivity_16-2.png (Reading Mail in Vim) -[10]: https://opensource.com/sites/default/files/uploads/day16-image3.png -[11]: https://github.com/itchyny/calendar.vim -[12]: mailto:git@github.com -[13]: https://opensource.com/sites/default/files/uploads/day16-image4.png -[14]: https://github.com/itchyny/calendar.vim/issues/156 diff --git a/translated/tech/20200126 Use Vim to send email and check your calendar.md b/translated/tech/20200126 Use Vim to send email and check your calendar.md new file mode 100644 index 0000000000..d19de3dfef --- /dev/null +++ b/translated/tech/20200126 Use Vim to send email and check your calendar.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Vim to send email and check your calendar) +[#]: via: (https://opensource.com/article/20/1/vim-email-calendar) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Vim 发送邮件和检查日历 +====== + +> 在我们的在 2020 年用开源实现更高生产力的二十种方式的第十六篇中,直接通过文本编辑器管理你的电子邮件和日历。 + +![Calendar close up snapshot][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 用 Vim 做(几乎)所有事情,第一部分 + +我经常使用两个文本编辑器 —— [Vim][2] 和 [Emacs][3]。为什么两者都用呢?它们有不同的使用场景,在本系列的后续几篇文章中,我将讨论其中的一些用例。 + +![][4] + +好吧,为什么要在 Vim 中执行所有操作?因为如果有一个应用程序是我可以访问的每台计算机上都有,那就是 Vim。如果你像我一样,可能已经在 Vim 中打发了很多时光。那么,为什么不将其用于**所有事情**呢? + +但是,在此之前,你需要做一些事情。首先是确保你在 Vim 中具有 Ruby 支持。你可以使用 `vim --version | grep ruby`。 如果结果不是 `+ruby`,则需要解决。这可能很棘手,你应该查看发行版的文档以获取正确的软件包。在 MacOS 上,是官方的 MacVim(不是 Brew 发行的),在大多数 Linux 发行版中,是 vim-nox 或 vim-gtk,而不是 vim-gtk3。 + +我使用 [Pathogen][5] 自动加载插件和捆绑软件。如果你使用 [Vundle][6] 或其他 Vim 软件包管理器,则需要调整以下命令才能使用它。 + +#### 在 Vim 中管理你的邮件 + +使 Vim 在你的生产力计划中发挥更大作用的一个很好的起点是使用它通过 [abook] [8] 发送和接收电子邮件,和使用 [Notmuch] [7] 访问你的联系人列表。你需要为此安装一些东西。下面的所有示例代码都运行在 Ubuntu 上,因此如果你使用其他发行版,则需要对此进行调整。通过以下步骤进行设置: + +``` +sudo apt install notmuch-vim ruby-mail +curl -o ~/.vim/plugin/abook --create-dirs https://raw.githubusercontent.com/dcbaker/vim-abook/master/plugin/abook.vim +``` + +到目前为止,一切都很好。现在启动 Vim 并执行 `:NotMuch`。由于是用较旧版本的邮件库 `notmuch-vim` 编写的,可能会出现一些警告,但总的来说,Vim 现在将成为功能齐全的 Notmuch 邮件客户端。 + +![Reading Mail in Vim][9] + +如果要搜索特定标签,请输入 `\t`,输入标签名称,然后按回车。这将拉出一个带有该标签的所有消息的列表。`\s` 组合键会弹出 `Search:` 提示符,可以对 Notmuch 数据库进行全面搜索。使用箭头键浏览消息列表,按回车键显示所选项目,然后输入 `\q` 退出当前视图。 + +要撰写邮件,请使用 `\c` 按键。你将看到一条空白消息。这是 `abook.vim` 插件发挥作用的位置。按下 `Esc` 并输入 `:AbookQuery `,其中 `` 是你要查找的名称或电子邮件地址的一部分。你将在 abook 数据库中找到与你的搜索匹配的条目列表。通过键入你想要的地址的编号,将其添加到电子邮件的地址行中。完成电子邮件的键入和编辑,按 `Esc` 退出编辑模式,然后输入 `,s` 发送。 + +如果要在 `:NotMuch` 启动时更改默认文件夹视图,则可以将变量 `g:notmuch_folders` 添加到你的 `.vimrc` 文件中: + +``` +let g:notmuch_folders = [ + \ [ 'new', 'tag:inbox and tag:unread' ], + \ [ 'inbox', 'tag:inbox' ], + \ [ 'unread', 'tag:unread' ], + \ [ 'News', 'tag:@sanenews' ], + \ [ 'Later', 'tag:@sanelater' ], + \ [ 'Patreon', 'tag:@patreon' ], + \ [ 'LivestockConservancy', 'tag:livestock-conservancy' ], + \ ] +``` + +Notmuch 插件的文档中涵盖了更多设置,包括设置标签键和使用其它的邮件程序。 + +#### 在 Vim 中查询日历 + +![][10] + +遗憾的是,似乎没有使用 vCalendar 或 iCalendar 格式的 Vim 日历程序。有个 [Calendar.vim][11],做得很好。设置 Vim 通过以下方式访问你的日历: + +``` +cd ~/.vim/bundle +git clone [git@github.com][12]:itchyny/calendar.vim.git +``` + +现在,你可以通过输入 `:Calendar` 在 Vim 中查看日历。你可以使用 `<` 和 `>` 键在年、月、周、日和时钟视图之间切换。如果要从一个特定的视图开始,请使用 `-view=` 标志告诉它你希望看到哪个视图。你也可以在任何视图中添加日期。例如,如果我想查看 2020 年 7 月 4 日这一周的情况,请输入 `:Calendar -view week 7 4 2020`。它的帮助信息非常好,可以使用 `?` 键进行访问。 + +![][13] + +Calendar.vim 还支持 Google Calendar(我需要),但是在 2019 年 12 月,Google 禁用了它的访问权限。作者已在 [GitHub 上这个提案][14]中发布了一种变通方法。 + +这样你就在 Vim 中有了这些:你的邮件、地址和日历。 但是这些还没有完成; 下一篇你将在 Vim 上做更多的事情! + +Vim 为作家提供了很多好处,无论他们是否具有技术意识。 + +需要保持时间表正确吗?了解如何使用这些免费的开源软件来做到这一点。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/vim-email-calendar + +作者:[Kevin 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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://www.vim.org/ +[3]: https://www.gnu.org/software/emacs/ +[4]: https://opensource.com/sites/default/files/uploads/day16-image1.png +[5]: https://github.com/tpope/vim-pathogen +[6]: https://github.com/VundleVim/Vundle.vim +[7]: https://opensource.com/article/20/1/organize-email-notmuch +[8]: https://opensource.com/article/20/1/sync-contacts-locally +[9]: https://opensource.com/sites/default/files/uploads/productivity_16-2.png (Reading Mail in Vim) +[10]: https://opensource.com/sites/default/files/uploads/day16-image3.png +[11]: https://github.com/itchyny/calendar.vim +[12]: mailto:git@github.com +[13]: https://opensource.com/sites/default/files/uploads/day16-image4.png +[14]: https://github.com/itchyny/calendar.vim/issues/156 From 15cd29ac36ff0762f837e743105c529ada961b3a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 19 Feb 2020 18:59:03 +0800 Subject: [PATCH 003/260] PRF @wxy --- ...m to send email and check your calendar.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/translated/tech/20200126 Use Vim to send email and check your calendar.md b/translated/tech/20200126 Use Vim to send email and check your calendar.md index d19de3dfef..ab81c8b4cb 100644 --- a/translated/tech/20200126 Use Vim to send email and check your calendar.md +++ b/translated/tech/20200126 Use Vim to send email and check your calendar.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use Vim to send email and check your calendar) @@ -10,9 +10,9 @@ 使用 Vim 发送邮件和检查日历 ====== -> 在我们的在 2020 年用开源实现更高生产力的二十种方式的第十六篇中,直接通过文本编辑器管理你的电子邮件和日历。 +> 在 2020 年用开源实现更高生产力的二十种方式的第十六篇文章中,直接通过文本编辑器管理你的电子邮件和日历。 -![Calendar close up snapshot][1] +![](https://img.linux.net.cn/data/attachment/album/202002/19/185842eyz2znxx1yc2ctnc.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 @@ -22,22 +22,22 @@ ![][4] -好吧,为什么要在 Vim 中执行所有操作?因为如果有一个应用程序是我可以访问的每台计算机上都有,那就是 Vim。如果你像我一样,可能已经在 Vim 中打发了很多时光。那么,为什么不将其用于**所有事情**呢? +好吧,为什么要在 Vim 中执行所有操作?因为如果有一个应用程序是我可以访问的每台计算机上都有的,那就是 Vim。如果你像我一样,可能已经在 Vim 中打发了很多时光。那么,为什么不将其用于**所有事情**呢? -但是,在此之前,你需要做一些事情。首先是确保你在 Vim 中具有 Ruby 支持。你可以使用 `vim --version | grep ruby`。 如果结果不是 `+ruby`,则需要解决。这可能很棘手,你应该查看发行版的文档以获取正确的软件包。在 MacOS 上,是官方的 MacVim(不是 Brew 发行的),在大多数 Linux 发行版中,是 vim-nox 或 vim-gtk,而不是 vim-gtk3。 +但是,在此之前,你需要做一些事情。首先是确保你的 Vim 具有 Ruby 支持。你可以使用 `vim --version | grep ruby`。如果结果不是 `+ruby`,则需要解决这个问题。这可能有点麻烦,你应该查看发行版的文档以获取正确的软件包。在 MacOS 上,用的是官方的 MacVim(不是 Brew 发行的),在大多数 Linux 发行版中,用的是 vim-nox 或 vim-gtk,而不是 vim-gtk3。 我使用 [Pathogen][5] 自动加载插件和捆绑软件。如果你使用 [Vundle][6] 或其他 Vim 软件包管理器,则需要调整以下命令才能使用它。 #### 在 Vim 中管理你的邮件 -使 Vim 在你的生产力计划中发挥更大作用的一个很好的起点是使用它通过 [abook] [8] 发送和接收电子邮件,和使用 [Notmuch] [7] 访问你的联系人列表。你需要为此安装一些东西。下面的所有示例代码都运行在 Ubuntu 上,因此如果你使用其他发行版,则需要对此进行调整。通过以下步骤进行设置: +使 Vim 在你的生产力计划中发挥更大作用的一个很好的起点是使用它通过 [Notmuch] [7] 发送和接收电子邮件,和使用 [abook] [8] 访问你的联系人列表。你需要为此安装一些东西。下面的所有示例代码都运行在 Ubuntu 上,因此如果你使用其他发行版,则需要对此进行调整。通过以下步骤进行设置: ``` sudo apt install notmuch-vim ruby-mail curl -o ~/.vim/plugin/abook --create-dirs https://raw.githubusercontent.com/dcbaker/vim-abook/master/plugin/abook.vim ``` -到目前为止,一切都很好。现在启动 Vim 并执行 `:NotMuch`。由于是用较旧版本的邮件库 `notmuch-vim` 编写的,可能会出现一些警告,但总的来说,Vim 现在将成为功能齐全的 Notmuch 邮件客户端。 +到目前为止,一切都很顺利。现在启动 Vim 并执行 `:NotMuch`。由于是用较旧版本的邮件库 `notmuch-vim` 编写的,可能会出现一些警告,但总的来说,Vim 现在将成为功能齐全的 Notmuch 邮件客户端。 ![Reading Mail in Vim][9] @@ -69,16 +69,16 @@ Notmuch 插件的文档中涵盖了更多设置,包括设置标签键和使用 ``` cd ~/.vim/bundle -git clone [git@github.com][12]:itchyny/calendar.vim.git +git clone git@github.com:itchyny/calendar.vim.git ``` -现在,你可以通过输入 `:Calendar` 在 Vim 中查看日历。你可以使用 `<` 和 `>` 键在年、月、周、日和时钟视图之间切换。如果要从一个特定的视图开始,请使用 `-view=` 标志告诉它你希望看到哪个视图。你也可以在任何视图中添加日期。例如,如果我想查看 2020 年 7 月 4 日这一周的情况,请输入 `:Calendar -view week 7 4 2020`。它的帮助信息非常好,可以使用 `?` 键进行访问。 +现在,你可以通过输入 `:Calendar` 在 Vim 中查看日历。你可以使用 `<` 和 `>` 键在年、月、周、日和时钟视图之间切换。如果要从一个特定的视图开始,请使用 `-view=` 标志告诉它你希望看到哪个视图。你也可以在任何视图中定位日期。例如,如果我想查看 2020 年 7 月 4 日这一周的情况,请输入 `:Calendar -view week 7 4 2020`。它的帮助信息非常好,可以使用 `?` 键参看。 ![][13] -Calendar.vim 还支持 Google Calendar(我需要),但是在 2019 年 12 月,Google 禁用了它的访问权限。作者已在 [GitHub 上这个提案][14]中发布了一种变通方法。 +Calendar.vim 还支持 Google Calendar(我需要),但是在 2019 年 12 月,Google 禁用了它的访问权限。作者已在 [GitHub 上的这个提案][14]中发布了一种变通方法。 -这样你就在 Vim 中有了这些:你的邮件、地址和日历。 但是这些还没有完成; 下一篇你将在 Vim 上做更多的事情! +这样你就在 Vim 中有了这些:你的邮件、地址簿和日历。但是这些还没有完成; 下一篇你将在 Vim 上做更多的事情! Vim 为作家提供了很多好处,无论他们是否具有技术意识。 @@ -91,7 +91,7 @@ via: https://opensource.com/article/20/1/vim-email-calendar 作者:[Kevin 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 6f33213b8cd5df8d3624dc2dd8d7c70ac37cbee7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 19 Feb 2020 19:02:11 +0800 Subject: [PATCH 004/260] PUB @wxy https://linux.cn/article-11908-1.html --- .../20200126 Use Vim to send email and check your calendar.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200126 Use Vim to send email and check your calendar.md (98%) diff --git a/translated/tech/20200126 Use Vim to send email and check your calendar.md b/published/20200126 Use Vim to send email and check your calendar.md similarity index 98% rename from translated/tech/20200126 Use Vim to send email and check your calendar.md rename to published/20200126 Use Vim to send email and check your calendar.md index ab81c8b4cb..032329e76e 100644 --- a/translated/tech/20200126 Use Vim to send email and check your calendar.md +++ b/published/20200126 Use Vim to send email and check your calendar.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11908-1.html) [#]: subject: (Use Vim to send email and check your calendar) [#]: via: (https://opensource.com/article/20/1/vim-email-calendar) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From 59e4f03fd8a5675f70c08bfa85831df019333459 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 20 Feb 2020 00:55:06 +0800 Subject: [PATCH 005/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200219=20Fedora?= =?UTF-8?q?=20at=20the=20Czech=20National=20Library=20of=20Technology?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200219 Fedora at the Czech National Library of Technology.md --- ...he Czech National Library of Technology.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 sources/tech/20200219 Fedora at the Czech National Library of Technology.md diff --git a/sources/tech/20200219 Fedora at the Czech National Library of Technology.md b/sources/tech/20200219 Fedora at the Czech National Library of Technology.md new file mode 100644 index 0000000000..d1354b99ff --- /dev/null +++ b/sources/tech/20200219 Fedora at the Czech National Library of Technology.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora at the Czech National Library of Technology) +[#]: via: (https://fedoramagazine.org/fedora-at-the-national-library-of-technology/) +[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) + +Fedora at the Czech National Library of Technology +====== + +![][1] + +Where do you turn when you have a fleet of public workstations to manage? If you’re the Czech [National Library of Technology][2] (NTK), you turn to Fedora. Located in Prague, the NTK is the Czech Republic’s largest science and technology library. As part of its public service mission, the NTK provides 150 workstations for public use. + +In 2018, the NTK moved these workstations from Microsoft Windows to Fedora. In the [press release][3] announcing this change, Director Martin Svoboda said switching to Fedora will “reduce operating system support costs by about two-thirds.” The choice to use Fedora was easy, according to NTK Linux Engineer Miroslav Brabenec. “Our entire Linux infrastructure runs on RHEL or CentOS. So for desktop systems, Fedora was the obvious choice,” he told Fedora Magazine. + +### User reception + +Changing an operating system is always a little bit risky—it requires user training and outreach. Brabenec said that non-IT staff asked for training on the new system. Once they learned that the same (or compatible) software was available, they were fine. + +The Library’s customers were on board right away. The Windows environment was based on thin client terminals, which were slow for intensive tasks like video playback and handling large office suite files. The only end-user education that the NTK needed to create was a [basic usage guide][4] and a desktop wallpaper that pointed to important UI elements. + +![User guidance desktop wallpaper from the National Technology Library.][5] + +Although Fedora provides development tools used by the Faculty of Information Technology at the Czech Technical University—and many of the NTK’s workstation users are CTU students—most of the application usage is what you might expect of a general-purpose workstation. Firefox dominates the application usage, followed by the Evince PDF viewer,  and the LibreOffice suite. + +### Updates + +NTK first deployed the workstations with Fedora 28. They decided to skip Fedora 29 and upgraded to Fedora 30 in early June 2019. The process was simple, according to Brabenec. “We prepared configuration, put it into Ansible. Via AWX I restarted all systems to netboot, image with kickstart, after first boot called provisioning callback on AWX, everything automatically set up via Ansible.” + +Initially, they had difficulties applying updates. Now they have a process for installing security updates daily. Each system is rebooted approximately every two weeks to make sure all of the updates get applied. + +Although he isn’t aware of any concrete plans for the future, Brabenec expects the NTK to continue using Fedora for public workstations. “Everyone is happy with it and I think that no one has a good reason to change it.” + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-at-the-national-library-of-technology/ + +作者:[Ben Cotton][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/bcotton/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/czech-techlib-816x345.png +[2]: https://www.techlib.cz/en/ +[3]: https://www.techlib.cz/default/files/download/id/86431/tiskova-zprava-z-31-7-2018.pdf +[4]: https://www.techlib.cz/en/82993-public-computers +[5]: https://fedoramagazine.org/wp-content/uploads/2020/02/ntk-wallpaper-1024x576.jpeg From 08061a2b6e5cb6c19c240c01f1b8defbca9fb4b0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 20 Feb 2020 01:00:05 +0800 Subject: [PATCH 006/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200219=20Don't?= =?UTF-8?q?=20like=20IDEs=3F=20Try=20grepgitvi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md --- ...20200219 Don-t like IDEs- Try grepgitvi.md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md diff --git a/sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md b/sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md new file mode 100644 index 0000000000..34caf67f71 --- /dev/null +++ b/sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Don't like IDEs? Try grepgitvi) +[#]: via: (https://opensource.com/article/20/2/no-ide-script) +[#]: author: (Yedidyah Bar David https://opensource.com/users/didib) + +Don't like IDEs? Try grepgitvi +====== +A simple and primitive script to open Vim with your file of choice. +![Files in a folder][1] + +Like most developers, I search and read source code all day long. Personally, I've never gotten used to integrated development environments (IDEs), and for years, I mainly used **grep** and copy/pasted file names to open Vi(m). + +Eventually, I came up with this script, slowly refining it as needed. + +Its dependencies are [Vim][2] and [rlwrap][3], and it is open source under the Apache 2.0 license. To use the script, [put it in your PATH][4], and run it inside a directory of text files with: + + +``` +`grepgitvi ` +``` + +It will return a numbered list of search results, prompt you for the number of the result you want to use, and open Vim with that result. After you exit Vim, it will show the list again in a loop until you enter anything other than a result number. You can also use the Up and Down arrow keys to select a file; this makes it easier (for me) to find which results I've already looked at. + +It's simple and primitive compared to modern IDEs, or even to more sophisticated uses of Vim, but that's what does the job for me. + +### The script + + +``` +#!/bin/bash + +# grepgitvi - grep source files, interactively open vim on results +# Doesn't really have to do much with git, other than ignoring .git +# +# Copyright Yedidyah Bar David 2019 +# +# SPDX-License-Identifier: Apache-2.0 +# +# Requires vim and rlwrap +# +# Usage: grepgitvi <grep options> <grep/vim pattern> +# + +TMPD=$(mktemp -d /tmp/grepgitvi.XXXXXX) +UNCOLORED=${TMPD}/uncolored +COLORED=${TMPD}/colored + +RLHIST=${TMPD}/readline-history + +[ -z "${DIRS}" ] && DIRS=. + +cleanup() { +        rm -rf "${TMPD}" +} + +trap cleanup 0 + +find ${DIRS} -iname .git -prune -o \\! -iname "*.min.css*" -type f -print0 > ${TMPD}/allfiles + +cat ${TMPD}/allfiles | xargs -0 grep --color=always -n -H "$@" > $COLORED +cat ${TMPD}/allfiles | xargs -0 grep -n -H "$@" > $UNCOLORED + +max=`cat $UNCOLORED | wc -l` +pat="${@: -1}" + +inp='' +while true; do +        echo "============================ grep results ===============================" +        cat $COLORED | nl +        echo "============================ grep results ===============================" +        prompt="Enter a number between 1 and $max or anything else to quit: " +        inp=$(rlwrap -H $RLHIST bash -c "read -p \"$prompt\" inp; echo \$inp") +        if ! echo "$inp" | grep -q '^[0-9][0-9]*$' || [ "$inp" -gt "$max" ]; then +                break +        fi + +        filename=$(cat $UNCOLORED | awk -F: "NR==$inp"' {print $1}') +        linenum=$(cat $UNCOLORED | awk -F: "NR==$inp"' {print $2-1}') +        vim +:"$linenum" +"norm zz" +/"${pat}" "$filename" +done +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/no-ide-script + +作者:[Yedidyah Bar David][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/didib +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://www.vim.org/ +[3]: https://linux.die.net/man/1/rlwrap +[4]: https://opensource.com/article/17/6/set-path-linux From 218746e29d2f53897129bb0d1ca2cd35fb0e008a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 20 Feb 2020 01:01:00 +0800 Subject: [PATCH 007/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200219=20Try=20?= =?UTF-8?q?this=20Bash=20script=20for=C2=A0large=20filesystems?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200219 Try this Bash script for-large filesystems.md --- ... this Bash script for-large filesystems.md | 335 ++++++++++++++++++ 1 file changed, 335 insertions(+) create mode 100644 sources/tech/20200219 Try this Bash script for-large filesystems.md diff --git a/sources/tech/20200219 Try this Bash script for-large filesystems.md b/sources/tech/20200219 Try this Bash script for-large filesystems.md new file mode 100644 index 0000000000..f0f0a88f2f --- /dev/null +++ b/sources/tech/20200219 Try this Bash script for-large filesystems.md @@ -0,0 +1,335 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Try this Bash script for large filesystems) +[#]: via: (https://opensource.com/article/20/2/script-large-files) +[#]: author: (Nick Clifton https://opensource.com/users/nickclifton) + +Try this Bash script for large filesystems +====== +A simple script to list files, directories, executables, and links. +![bash logo on green background][1] + +Have you ever wanted to list all the files in a directory, but just the files, nothing else? How about just the directories? If you have, then the following script, which is open source under GPLv3, could be what you have been looking for. + +Of course, you could use the **find** command: + + +``` +`find . -maxdepth 1 -type f -print` +``` + +But this is cumbersome to type, produces unfriendly output, and lacks some of the refinement of the **ls** command. You could also combine **ls** and **grep** to achieve the same result: + + +``` +`ls -F . | grep -v /` +``` + +But again, this is clunky. This script provides a simple alternative. + +### Usage + +The script provides four main functions, which depend upon which name you call: **lsf** lists files, **lsd** lists directories, **lsx** lists executables, and **lsl** lists links. + +There is no need to install multiple copies of the script, as symbolic links work. This saves space and makes updating the script easier. + +The script works by using the **find** command to do the searching, and then it runs **ls** on each item it finds. The nice thing about this is that any arguments given to the script are passed to the **ls** command. So, for example, this lists all files, even those that start with a dot: + + +``` +`lsf -a` +``` + +To list directories in long format, use the **lsd** command: + + +``` +`lsd -l` +``` + +You can provide multiple arguments, and also file and directory paths. + +This provides a long classified listing of all of files in the current directory's parent directory, and in the **/usr/bin** directory: + + +``` +`lsf -F -l .. /usr/bin` +``` + +One thing that the script does not currently handle, however, is recursion. This command lists only the files in the current directory. + + +``` +`lsf -R` +``` + +The script does not descend into any subdirectories. This is something that may be fixed one day. + +### Internals + +The script is written in a top-down fashion with the initial functions at the start of the script and the body of the work performed near the end. There are only two functions that really matter in the script. The **parse_args()** function peruses the command line, separates options from pathnames, and scripts specific options from the **ls** command-line options. + +The **list_things_in_dir()** function  takes a directory name as an argument and runs the **find** command on it. Each item found is passed to the **ls** command for display. + +### Conclusion + +This is a simple script to accomplish a simple function. It is a time saver and can be surprisingly useful when working with large filesystems. + +### The script + + +``` +#!/bin/bash + +# Script to list: +#      directories (if called "lsd") +#      files       (if called "lsf") +#      links       (if called "lsl") +#  or  executables (if called "lsx") +# but not any other type of filesystem object. +# FIXME: add lsp   (list pipes) +# +# Usage: +#   <command_name> [switches valid for ls command] [dirname...] +# +# Works with names that includes spaces and that start with a hyphen. +# +# Created by Nick Clifton. +# Version 1.4 +# Copyright (c) 2006, 2007 Red Hat. +# +# This is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 3, or (at your +# option) any later version. + +# It is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# GNU General Public License for more details. + +# ToDo: +#  Handle recursion, eg:  lsl -R +#  Handle switches that take arguments, eg --block-size +#  Handle --almost-all, --ignore-backups, --format and --ignore + +main () +{ +  init +  +  parse_args ${1+"$@"} + +  list_objects + +  exit 0 +} + +report () +{ +  echo $prog": " ${1+"$@"} +} + +fail () +{ +  report " Internal error: " ${1+"$@"} +  exit 1 +} + +# Initialise global variables. +init () +{ +  # Default to listing things in the current directory. +  dirs[0]="."; +  +  # num_dirs is the number of directories to be listed minus one. +  # This is because we are indexing the dirs[] array from zero. +  num_dirs=0; +  +  # Default to ignoring things that start with a period. +  no_dots=1 +  +  # Note - the global variables 'type' and 'opts' are initialised in +  # parse_args function. +} + +# Parse our command line +parse_args () +{ +  local no_more_args + +  no_more_args=0 ; + +  prog=`basename $0` ; + +  # Decide if we are listing files or directories. +  case $prog in +    lsf | lsf.sh) +      type=f +      opts=""; +      ;; +    lsd | lsd.sh) +      type=d +      # The -d switch to "ls" is presumed when listing directories. +      opts="-d"; +      ;; +    lsl | lsl.sh) +      type=l +      # Use -d to prevent the listed links from being followed. +      opts="-d"; +      ;; +    lsx | lsx.sh) +      type=f +      find_extras="-perm /111" +      ;;     +    *) +      fail "Unrecognised program name: '$prog', expected either 'lsd', 'lsf', 'lsl' or 'lsx'" +      ;; +  esac + +  # Locate any additional command line switches for ls and accumulate them. +  # Likewise accumulate non-switches to the directories list. +  while [ $# -gt 0 ] +  do +    case "$1" in +      # FIXME: Handle switches that take arguments, eg --block-size +      # FIXME: Properly handle --almost-all, --ignore-backups, --format +      # FIXME:   and --ignore +      # FIXME: Properly handle --recursive +      -a | -A | --all | --almost-all) +        no_dots=0; +        ;; +      --version) +        report "version 1.2" +        exit 0 +        ;; +      --help) +        case $type in +          d) report "a version of 'ls' that lists only directories" ;; +          l) report "a version of 'ls' that lists only links" ;; +          f) if [ "x$find_extras" = "x" ] ; then +               report "a version of 'ls' that lists only files" ; +             else +              report "a version of 'ls' that lists only executables"; +             fi ;; +        esac +        exit 0 +        ;; +      --) +        # A switch to say that all further items on the command line are +        # arguments and not switches. +        no_more_args=1 ; +        ;; +      -*) +        if [ "x$no_more_args" = "x1" ] ; +        then +          dirs[$num_dirs]="$1"; +          let "num_dirs++" +        else +          # Check for a switch that just uses a single dash, not a double +          # dash.  This could actually be multiple switches combined into +          # one word, eg "lsd -alF".  In this case, scan for the -a switch. +          # XXX: FIXME: The use of =~ requires bash v3.0+. +          if [[ "x${1:1:1}" != "x-" && "x$1" =~ "x-.*a.*" ]] ; +          then +            no_dots=0; +          fi +          opts="$opts $1"; +        fi +        ;; +      *) +        dirs[$num_dirs]="$1"; +        let "num_dirs++" +        ;; +    esac +    shift +  done + +  # Remember that we are counting from zero not one. +  if [ $num_dirs -gt 0 ] ; +  then +    let "num_dirs--" +  fi +} + +list_things_in_dir () +{ +  local dir + +  # Paranoia checks - the user should never encounter these. +  if test "x$1" = "x" ; +  then +    fail "list_things_in_dir called without an argument" +  fi + +  if test "x$2" != "x" ; +  then +    fail "list_things_in_dir called with too many arguments" +  fi + +  # Use quotes when accessing $dir in order to preserve +  # any spaces that might be in the directory name. +  dir="${dirs[$1]}"; + +  # Catch directory names that start with a dash - they +  # confuse pushd. +  if test "x${dir:0:1}" = "x-" ; +  then +    dir="./$dir" +  fi +  +  if [ -d "$dir" ] +  then +    if [ $num_dirs -gt 0 ] +    then +      echo "  $dir:" +    fi + +    # Use pushd rather passing the directory name to find so that the +    # names that find passes on to xargs do not have any paths prepended. +    pushd "$dir" > /dev/null +    if [ $no_dots -ne 0 ] ; then +      find . -maxdepth 1 -type $type $find_extras -not -name ".*" -printf "%f\000" \ +        | xargs --null --no-run-if-empty ls $opts -- ; +    else +      find . -maxdepth 1 -type $type $find_extras -printf "%f\000" \ +        | xargs --null --no-run-if-empty ls $opts -- ; +    fi +    popd > /dev/null +  else +    report "directory '$dir' could not be found" +  fi +} + +list_objects () +{ +  local i + +  i=0; +  while [ $i -le $num_dirs ] +  do +    list_things_in_dir i +    let "i++" +  done +} + +# Invoke main +main ${1+"$@"} +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/script-large-files + +作者:[Nick Clifton][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/nickclifton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) From b9d1c924e35fe6ad1158fd052afbf448eb3d3de5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 20 Feb 2020 01:03:24 +0800 Subject: [PATCH 008/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200219=20How=20?= =?UTF-8?q?to=20conveniently=20unsubscribe=20from=20a=20mailing=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200219 How to conveniently unsubscribe from a mailing list.md --- ...niently unsubscribe from a mailing list.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20200219 How to conveniently unsubscribe from a mailing list.md diff --git a/sources/tech/20200219 How to conveniently unsubscribe from a mailing list.md b/sources/tech/20200219 How to conveniently unsubscribe from a mailing list.md new file mode 100644 index 0000000000..ab0a962efa --- /dev/null +++ b/sources/tech/20200219 How to conveniently unsubscribe from a mailing list.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to conveniently unsubscribe from a mailing list) +[#]: via: (https://opensource.com/article/20/2/how-unsubscribe-mailing-list) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to conveniently unsubscribe from a mailing list +====== +Cut down on your email clutter by removing yourself from email lists you +no longer need. +![Photo by Anthony Intraversato on Unsplash][1] + +If you're on an email discussion group long enough, at some point, you'll see an email from a list member asking to be unsubscribed. Typically, at least 10 other people on the list will respond with instructions on how to unsubscribe, and those 10 responses will be answered by 10 more people confirming or commenting on the instructions. That's a _lot_ of traffic to a mailing list just so one person can unsubscribe. + +But unsubscribing from a list can be confusing, especially if you've gotten on the list by accident. It's frustrating to discover that you've been added to a list, and it's annoying that you have to take time out of your day to extricate yourself. This article is here to help make unsubscribing fast, easy, and graceful. + +Never send an unsubscribe email to the same email address you use to post messages + +### Unsubscribe by email + +Mailing lists are controlled by mailing list software (like [GNU Mailman][2]) on a server. You probably aren't aware of the software controlling a mailing list you're on, because they're usually designed to stay out of the way and just deliver mail. But as a member of a mailing list, you actually have some user control over the software. + +Some mailing lists allow you to unsubscribe using an automated email address. It can be a little confusing because the email address you use to unsubscribe is NOT the email address you use to send messages to the list. Essentially, you're sending a special command to the email server, telling it to take you off the list. This is a convenient method of unsubscribing because it means you don't have to compose a message or wait for anyone to take action. You speak directly to the computer sending the email, and it does exactly as it's told. + +To unsubscribe from a list, take the email address of the list, add **-leave** just before the **@** symbol, and send a message. You can email a blank message; the computer doesn't care. The fact that you're emailing the list with the **-leave** command in front of the **@** symbol is all it needs. + +Here's an example. + +Say you've joined the mailing list Funny Squirrels. You send a few messages to [funnysquirrels@example.com][3] but soon find that squirrels are not as amusing as you'd hoped. To unsubscribe, you can send an email to: + + +``` +`funnysquirrels-leave@example.com` +``` + +You may get a final confirmation email back, and then you'll hear from the mailing list no more. + +#### Custom email commands + +Sometimes the administrator of a mail server changes the command for unsubscribing. Ideally, they'll include the unsubscribe email address in the footer of emails sent to the mailing list, so check for that before sending your parting email. + +The thing to keep in mind is that an unsubscribe email _never_ goes to the actual list, meaning you should never send an unsubscribe email to the same email address you use to post messages. There's a special, separate email address reserved for the unsubscribe command. + +### Unsubscribing by webform + +Some mailing lists have a webform for unsubscribing, and ideally, it can be found in the footer of each mailing list message. You can navigate to the webform and opt out of your subscription. + +This method is common for commercial mailing lists, and it's sometimes a way for them to capture any feedback you have about the list, why you're leaving, and so on. Like the automated email method, the intent is for you to maintain full control of your own subscription. You never have to wait for a human to take you off of a list; instead, you can issue commands directly to a computer. + +![Example unsubscribe web form][4] + +A webform may send you a final confirmation email, and after that, you should hear nothing from that mailing list ever again. + +### Unsubscribing like a pro + +Leaving a mailing list is a guilt-free and nonaggressive act. When you want to leave a mailing list, you should be able to find an unsubscribe email address or webform to make it automated and final. + +If, in spite of using the methods above, you can't leave a mailing list, don't email the list. Very few people on the mailing list have control over who is subscribed, and sometimes the people who have access to the list of subscribers are not monitoring the list—they're only maintaining the server. Instead, find out what server hosts the mailing list, and contact the hosting provider to alert them of the abuse. + +You can find the host of a mailing list by searching for the server name (the part of the email address to the _right_ of the **@** symbol) on a **whois** service. If you're running Linux, you can do this from a terminal: + + +``` +`$ whois ` +``` + +Otherwise, use the [Whois.net][5] website. + +Whois provides the internet hosting provider of any email server plus the abuse and support contact information. + +Remember: you are always free to leave a mailing list for any reason, without getting permission from anyone else. And now that you know how, you'll be able to unsubscribe like a pro! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/how-unsubscribe-mailing-list + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/anthony-intraversato-pt_wqgzaiu8-unsplash.jpg?itok=5bbMlgt8 (Photo by Anthony Intraversato on Unsplash) +[2]: https://www.list.org/ +[3]: mailto:funnysquirrels@example.com +[4]: https://opensource.com/sites/default/files/uploads/mail-webform.jpg (Example unsubscribe web form) +[5]: http://whois.net From 45ca629fac051fdbae9ad991bb0bb66a26dd305a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 20 Feb 2020 01:04:56 +0800 Subject: [PATCH 009/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200219=20How=20?= =?UTF-8?q?to=20find=20what=20you=E2=80=99re=20looking=20for=20on=20Linux?= =?UTF-8?q?=20with=20find?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200219 How to find what you-re looking for on Linux with find.md --- ...t you-re looking for on Linux with find.md | 240 ++++++++++++++++++ 1 file changed, 240 insertions(+) create mode 100644 sources/tech/20200219 How to find what you-re looking for on Linux with find.md diff --git a/sources/tech/20200219 How to find what you-re looking for on Linux with find.md b/sources/tech/20200219 How to find what you-re looking for on Linux with find.md new file mode 100644 index 0000000000..3b0aa3ed68 --- /dev/null +++ b/sources/tech/20200219 How to find what you-re looking for on Linux with find.md @@ -0,0 +1,240 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to find what you’re looking for on Linux with find) +[#]: via: (https://www.networkworld.com/article/3527420/how-to-find-what-you-re-looking-for-on-linux-with-find.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to find what you’re looking for on Linux with find +====== +The find command has a huge array of options to help you locate exactly the files you're looking for on a Linux system. This post explores a series of extremely useful commands. +CSA Images / Getty Images + +There are a number of commands for finding files on Linux systems, but there are also a huge number of options that you can deploy when looking for them. + +For example, you can find files not just by their names, but by their owners and/or groups, their age, their size, the assigned permissions, the last time they were accessed, the associated inodes and even whether the files belong to an account or group that no longer exists on the system and so on. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +You can also specify where a search should start, how deeply into the file system the search should reach and how much the search result will tell you about the files it finds. + +And all these criteria can be handled by the **find** command. + +Examples of finding files by these criteria are provided below. In some commands, errors (such as trying to list files that you don’t have read access to), error output will be sent to **/dev/null** so that we don’t have to look at it. In others, we’ll simply run as root to avoid this problem. + +Keep in mind that additional options exist. This post covers a lot of ground, but not all of the ways that the **find** command can help locate files for you. + +### Picking a starting point + +With **find**, you can either select a point or start where you are. To select a starting spot, enter it following the word “find”. For example, “find /usr” or “find ./bin” would search starting the **/usr** directory or the **bin** directory in the current location while “find ~” would start in your home directory even if you’re currently located in some other location in the file system. + +[][2] + +### Picking what you want to see + +One of the most commonly used search strategies is to search for files by name. This requires using the **-name** option. + +By default, **find** will show you the full path to the files it finds. This is the same thing you would see if you add **-print** to your command. If you want to see the details associated with a file – its length, permissions, etc., you would need to add **-ls** to the end of your **find** command. + +``` +$ find ~/bin -name tryme +/home/shs/bin/tryme +$ find ~/bin -name tryme -print +/home/shs/bin/tryme +$ find ~/bin -name tryme -ls + 917528 4 -rwx------ 1 shs shs 139 Apr 8 2019 /home/shs/bin/tryme +``` + +You can also find files using substrings. For example, if you replace "tryme" in the example above with "try*", you'll find all the files with names that begin with "try". + +Finding files by name is probably the most typical use of the **find** command, but there are so many other ways to look for files and good reasons to want to. The sections below show how to use many of the other criteria available. + +In addition, when searching for files by size, group, inode etc., you probably will want some confirmation that the files found match what you were looking for. Using the **-ls** option to display the details is often very helpful. + +### Finding files by size + +Finding files by size requires use of the **-size** option and a little finesse with the specifications. If you specify **-size 189b**, for you example, you’re going to find files that are 189 blocks long, not 189 bytes. For bytes, you would need to use **-size 189c** (characters). And, if you specify **-size 200w**, you’re going to find files that are 200 words – words as in "two-byte increments", not words as in "those things we all say to each other". You can also look for file by providing sizes in kilobytes (k), megabytes (M) and gigabytes (G). + +Most of the time, Linux users will be searching for files that are larger than some selected size. For example, to find files that are larger than a gigabyte, you might use a command like this where the +1G means "larger than a gigabyte": + +``` +$ find -size +1G -ls 2>/dev/null + 787715 1053976 -rw-rw-r-- 1 shs shs 1079263432 Dec 21 2018 ./backup.zip + 801834 1052556 -rw-rw-r-- 1 shs shs 1077809525 Dec 21 2018 ./2019/hold.zip +``` + +### Finding files by inode # + +You can find files by the inode that is used to maintain the file’s metadata (i.e., everything but the file content and file name). + +``` +$ find -inum 919674 -ls 2>/dev/null + 919674 4 -rw-rw-r-- 1 shs shs 512 Dec 27 15:25 ./bin/my.log +``` + +### Finding files with a specific file owner or group + +Finding files by owner or group is also very straightforward. Here we use sudo to overcome permission issues. + +``` +$ sudo find /home -user nemo -name "*.png"-ls + 1705219 4 drwxr-xr-x 2 nemo nemo 4096 Jan 28 08:50 /home/nemo/Pictures/me.png +``` + +In this command, we look for a file that is owned by a multi-user group called “admins”. + +``` +# find /tmp -group admins -ls + 262199 4 -rwxr-x--- 1 dory admins 27 Feb 16 18:57 /tmp/testscript +``` + +### Finding files with no owners or groups + +You can look for files that don't belong to any users currently set up on the system by using the **-nouser** option as shown in the command below. + +``` +# find /tmp -nouser -ls +262204 4 -rwx------ 1 1016 1016 17 Feb 17 16:42 /tmp/hello +``` + +Notice that the listing shows the old user's UID and GID – a clear indication that this user is not defined on the system. This kind of command will find files that were likely created in other-than-home directories by users whose accounts have since been removed from the system or in home directories that were not removed after the user account was removed. Similarly, the **-nogroup** option would find such files – especially when these users were the only members of the associated groups. + +### Finding files by last update time + +In this command, we look for files that have been updated in the last 24 hours in a particular user's home directory. The **sudo** is being used to allow searching another user’s home directory. + +``` +$ sudo find /home/nemo -mtime -1 +/home/nemo +/home/nemo/snap/cheat +/home/nemo/tryme +``` + +### Finding files by when permissions were last changed + +The **-ctime** option can help you find files that have had their status (e.g., permissions) changed within some referenced time frame. Here’s an example of looking for files that had permission changes within the last day: + +``` +$ find . -ctime -1 -ls + 787987 4 -rwxr-xr-x 1 shs shs 189 Feb 11 07:31 ./tryme +``` + +Keep in mind that the date and time displayed reflect the last updates to the file contents. You will have to use a command like **stat** to see all three times associated with a file (file creation, modification and status changes) . + +### Finding files based on last access times + +In this command, we look for local pdf files that were accessed within the last two days using the **-atime** option. + +``` +$ find -name "*.pdf" -atime -2 +./Wingding_Invites.pdf +``` + +### Finding files based on their age relative to another file + +You can use the -newer option to find files that are newer than some other file. + +``` +$ find . -newer dig1 -ls + 786434 68 drwxr-xr-x 67 shs shs 69632 Feb 16 19:05 . + 1064442 4 drwxr-xr-x 5 shs shs 4096 Feb 16 11:06 ./snap/cheat + 791846 4 -rw-rw-r-- 1 shs shs 649 Feb 13 14:26 ./dig +``` + +There is no corresponding **-older** option, but you can get a similar result with **! -newer** (i.e., not newer), which means almost the same thing. + +### Finding files by type + +Finding a file by file type, you get a lot of choices – regular files, directories, block and character files, etc. Here’s a list of the file type options: + +``` +b block (buffered) special +c character (unbuffered) special +d directory +p named pipe (FIFO) +f regular file +l symbolic link +s socket +``` + +Here’s an example looking for symbolic links: + +``` +$ find . -type l -ls + 805717 0 lrwxrwxrwx 1 shs shs 11 Apr 10 2019 ./volcano -> volcano.pdf + 918552 0 lrwxrwxrwx 1 shs shs 1 Jun 16 2018 ./letter -> pers/letter2mom +``` + +### Limiting how deeply find should look + +The **-mindepth** and **-maxdepth** options control how deeply into the file system (from the current location or starting point) your searches will look. + +``` +$ find -maxdepth 3 -name "*loop" +./bin/save/oldloop +./bin/long-loop +./private/loop +``` + +### Finding files only if empty + +In this command, we look for empty files, but no further than directories and their subdirectories. + +``` +$ find . -maxdepth 2 -empty -type f -ls + 917517 0 -rw-rw-r-- 1 shs shs 0 Sep 23 11:00 ./complaints/newfile + 792050 0 -rw-rw-r-- 1 shs shs 0 Oct 4 19:02 ./junk +``` + +### Finding files by permissions + +You can find files that have specific permissions set using the **-perm** option. In the example below, we are looking only for regular files (**-type f**) to avoid seeing symbolic links that are given these permissions by default even if the file they refer to is restricted. + +``` +$ find -perm 777 -type f -ls +find: ‘./.dbus’: Permission denied + 798748 4 -rwxrwxrwx 1 shs shs 15 Mar 28 2019 ./runme +``` + +### Using find to help you get rid of files + +You can use the find command to both locate and then remove files if you use a command like this one: + +``` +$ find . -name runme -exec rm {} \; +``` + +The {} represents the name of each of the files located by the search criteria. + +One very useful option is to replace **-exec** with **-ok**. When you do this, **find** will ask for a confirmation before it removes any file. + +``` +$ find . -name runme -ok rm -rf {} \; +< rm ... ./bin/runme > ? +``` + +Removing a file isn't the only thing that **-ok** and **-rm** can do for you. For example, you could copy, rename or move files. + +There are really a lot of options for using the find command effectively and undoubtedly some that haven’t been covered in this post. I hope you’ve found some that are new and especially promising. + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3527420/how-to-find-what-you-re-looking-for-on-linux-with-find.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/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From 6a1108c5129c33e8f80014cfc222317f8ef3f291 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 20 Feb 2020 01:05:57 +0800 Subject: [PATCH 010/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200219=20A=20$3?= =?UTF-8?q?99=20device=20that=20translates=20brain=20signals=20into=20digi?= =?UTF-8?q?tal=20commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200219 A -399 device that translates brain signals into digital commands.md --- ...tes brain signals into digital commands.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/talk/20200219 A -399 device that translates brain signals into digital commands.md diff --git a/sources/talk/20200219 A -399 device that translates brain signals into digital commands.md b/sources/talk/20200219 A -399 device that translates brain signals into digital commands.md new file mode 100644 index 0000000000..e9c13ff8d2 --- /dev/null +++ b/sources/talk/20200219 A -399 device that translates brain signals into digital commands.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A $399 device that translates brain signals into digital commands) +[#]: via: (https://www.networkworld.com/article/3526446/nextmind-wearable-device-translates-brain-signals-into-digital-commands.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +A $399 device that translates brain signals into digital commands +====== +Startup NextMind is readying a $399 development kit for its brain-computer interface technology that enables users to interact, hands-free, with computers and VR/AR headsets. +MetamorWorks / Getty Images + +Scientists have long envisioned brain-sensing technology that can translate thoughts into digital commands, eliminating the need for computer-input devices like a keyboard and mouse. One company is preparing to ship its latest contribution to the effort: a $399 development package for a noninvasive, AI-based, brain-computer interface. + +The kit will let "users control anything in their digital world by using just their thoughts," [NextMind][1], a commercial spinoff of a cognitive neuroscience lab claims in a [press release][2]. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +The company says that its puck-like device inserts into a cap or headband and rests on the back of the head. The dry electrode-based receiver then grabs data from the electrical signals generated through neuron activity. It uses machine learning algorithms to convert that signal output into computer controls. The interaction could be with a computer, artificial-reality or virtual-reality headset, or [IoT][4] module. + +"Imagine taking your phone to send a text message without ever touching the screen, without using Siri, just by using the speed and power of your thoughts," said NextMind founder Sid Kouider in a [video presentation][5] at Helsinki startup conference Slush in late 2019. + +Advances in neuroscience are enabling real-time consciousness-decoding, without surgery or a doctor visit, according to Kouider. + +One obstacle that has thwarted previous efforts is the human skull, which can act as a barrier to sensors. It’s been difficult for scientists to differentiate indicators from noise, and some past efforts have only been able to discern basic things, such as whether or not a person is in a state of sleep or relaxation. New materials, better sensors, and more sophisticated algorithms and modeling have overcome some of those limitations. NextMind’s noninvasive technology "translates the data in real time," Kouider says. + +Essentially, what happens is that a person’s eyes project an image of what they see onto the visual cortex in the back of the head, a bit like a projector. The NextMind device decodes the neural activity created as the object is viewed and sends that information, via an SDK, back as an input to a computer. So, by fixing one’s gaze on an object, one selects that object. For example, a user could select a screen icon by glancing at it. + +[][6] + +"The demos were by no means perfect, but there was no doubt in my mind that the technology worked," [wrote VentureBeat writer Emil Protalinski][7], who tested a pre-release device in January. + +Kouider has stated it’s the "intent" aspect of the technology that’s most interesting; if a person focuses on one thing more than something else, the technology can decode the neural signals to capture that user’s intent. + +"It really gives you a kind of sixth sense, where you can feel your brain in action, thanks to the feedback loop between your brain and a display," Kouider says in the Slush presentation. + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3526446/nextmind-wearable-device-translates-brain-signals-into-digital-commands.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.next-mind.com/ +[2]: https://www.businesswire.com/news/home/20200105005107/en/CES-2020-It%E2%80%99s-Mind-Matter +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: http://www.networkworld.com/cms/article/3207535 +[5]: https://youtu.be/RHuaNDSxH0o +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://venturebeat.com/2020/01/05/nextmind-is-building-a-real-time-brain-computer-interface-unveils-dev-kit-for-399/ +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From ef333a1dc97cbd690d72650795b16fee1aaf641b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 20 Feb 2020 01:06:36 +0800 Subject: [PATCH 011/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200219=20Multic?= =?UTF-8?q?loud,=20security=20integration=20drive=20massive=20SD-WAN=20ado?= =?UTF-8?q?ption?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200219 Multicloud, security integration drive massive SD-WAN adoption.md --- ...tegration drive massive SD-WAN adoption.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/talk/20200219 Multicloud, security integration drive massive SD-WAN adoption.md diff --git a/sources/talk/20200219 Multicloud, security integration drive massive SD-WAN adoption.md b/sources/talk/20200219 Multicloud, security integration drive massive SD-WAN adoption.md new file mode 100644 index 0000000000..3d690bdc3a --- /dev/null +++ b/sources/talk/20200219 Multicloud, security integration drive massive SD-WAN adoption.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Multicloud, security integration drive massive SD-WAN adoption) +[#]: via: (https://www.networkworld.com/article/3527194/multicloud-security-integration-drive-massive-sd-wan-adoption.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Multicloud, security integration drive massive SD-WAN adoption +====== +40% year-over year SD-WAN growth through 2022 is being fueled by relationships built between vendors including Cisco, VMware, Juniper, and Arista and service provders AWS, Microsoft Azure, Google Anthos, and IBM RedHat. +[Gratisography][1] [(CC0)][2] + +Increasing cloud adoption as well as improved network security, visibility and manageability are driving enterprise software-defined WAN ([SD-WAN][3]) deployments at a breakneck pace. + +According to research from IDC, software- and infrastructure-as-a-service (SaaS and IaaS) offerings in particular have been driving SD-WAN implementations in the past year, said Rohit Mehra, vice president, network infrastructure at  IDC. + +**Read about edge networking** + + * [How edge networking and IoT will reshape data centers][4] + * [Edge computing best practices][5] + * [How edge computing can help secure the IoT][6] + + + +For example, IDC says that its recent surveys of customers show that 95% will be using [SD-WAN][7] technology within two years, and that 42% have already deployed it. IDC also says the SD-WAN infrastructure market will hit $4.5 billion by 2022, growing at a more than 40% yearly clip between now and then. + +“The growth of SD-WAN is a broad-based trend that is driven largely by the enterprise desire to optimize cloud connectivity for remote sites,” Mehra said. + +Indeed the growth of multicloud networking is prompting many businesses to re-tool their networks in favor of SD-WAN technology, Cisco wrote recently. SD-WAN is critical for businesses adopting cloud services, acting as a connective tissue between the campus, branch, [IoT][8], [data center][9] and cloud.  The company said surveys show Cisco customers have, on average, 30 paid SaaS applications each. And that they are actually using many more – over 100 in several cases, the company said. + +Part of this trend is driven by the relationships that networking vendors such as Cisco, VMware, Juniper, Arista and others have been building with the likes of Amazon Web Services, Microsoft Azure, Google Anthos and IBM RedHat.  + +An indicator of the growing importance of the SD-WAN and multicloud relationship came last December when AWS announced key services for its cloud offering that included new integration technologies such as [AWS Transit Gateway][10], which lets customers connect their Amazon Virtual Private Clouds and their on-premises networks to a single gateway. Aruba, Aviatrix Cisco, Citrix Systems, Silver Peak and Versa already announced support for the technology which promises to simplify and enhance the performance of SD-WAN integration with AWS cloud resources. + +[][11] + +Going forward the addition of features such as cloud-based application insights and performance monitoring will be a key part of SD-WAN rollouts, Mehra said. + +While the SD-WAN and cloud relationship is growing, so, too, is the need for integrated security features. + +“The way SD-WAN offerings integrate security is so much better than traditional ways of securing WAN traffic which usually involved separate packages and services," Mehra said. "SD-WAN is a much more agile security environment.” Security, analytics and WAN optimization are viewed as top SD-WAN component, with integrated security being the top requirement for next-generation SD-WAN solutions, Mehra said.  + +Increasingly, enterprises will look less at point SD-WAN solutions and instead will favor platforms that solve a wider range of network management and security needs, Mehra said. They will look for SD-WAN platforms that integrate with other aspects of their IT infrastructure including corporate data-center networks, enterprise campus LANs, or [public-cloud][12] resources, he said. They will look for security services to be baked in, as well as support for a variety of additional functions such as visibility, analytics, and unified communications, he said. + +“As customers continue to integrate their infrastructure components with software they can do things like implement consistent management and security policies based on user, device or application requirements across their LANs and WANs and ultimately achieve a better overall application experience,” Mehra said. + +An emerging trend is the need for SD-WAN packages to support [SD-branch][13] technology. More than 70% of IDC's surveyed customers expect to use SD-Branch within next year, Mehra said.  In recent weeks [Juniper][14] and [Aruba][15] have enhanced SD-Branch offerings, a trend that is expected to continue this year.  + +SD-Branch builds on the concepts and support of SD-WAN but is more specific to the networking and management needs of LANs in the branch. Going forward, how SD-Branch integrates other technologies such as analytics, voice, unified communications and video will be key drivers of that technology.   + +Join the Network World communities on [Facebook][16] and [LinkedIn][17] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3527194/multicloud-security-integration-drive-massive-sd-wan-adoption.html + +作者:[Michael Cooney][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/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.pexels.com/photo/black-and-white-branches-tree-high-279/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[4]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html +[5]: https://www.networkworld.com/article/3331978/lan-wan/edge-computing-best-practices.html +[6]: https://www.networkworld.com/article/3331905/internet-of-things/how-edge-computing-can-help-secure-the-iot.html +[7]: https://www.networkworld.com/article/3489938/what-s-hot-at-the-edge-for-2020-everything.html +[8]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[9]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[10]: https://aws.amazon.com/transit-gateway/ +[11]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[12]: https://www.networkworld.com/article/2159885/cloud-computing-gartner-5-things-a-private-cloud-is-not.html +[13]: https://www.networkworld.com/article/3250664/sd-branch-what-it-is-and-why-youll-need-it.html +[14]: https://www.networkworld.com/article/3487801/juniper-broadens-sd-branch-management-switch-options.html +[15]: https://www.networkworld.com/article/3513357/aruba-reinforces-sd-branch-with-security-management-upgrades.html +[16]: https://www.facebook.com/NetworkWorld/ +[17]: https://www.linkedin.com/company/network-world From d9e88ac7375b596228f832d979b6313507f90e41 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 20 Feb 2020 08:30:43 +0800 Subject: [PATCH 012/260] translating --- ...FuryBSD- A New Desktop BSD Distribution.md | 94 ------------------- ...FuryBSD- A New Desktop BSD Distribution.md | 94 +++++++++++++++++++ 2 files changed, 94 insertions(+), 94 deletions(-) delete mode 100644 sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md create mode 100644 translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md diff --git a/sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md b/sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md deleted file mode 100644 index d5f4f5da89..0000000000 --- a/sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md +++ /dev/null @@ -1,94 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Meet FuryBSD: A New Desktop BSD Distribution) -[#]: via: (https://itsfoss.com/furybsd/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Meet FuryBSD: A New Desktop BSD Distribution -====== - -In the last couple of months, a few new desktop BSD have been announced. There is [HyperbolaBSD which was Hyperbola GNU/Linux][1] previously. Another new entry in the [BSD][2] world is [FuryBSD][3]. - -### FuryBSD: A new BSD distribution - -![][4] - -At its heart, FuryBSD is a very simple beast. According to [the site][5], “FuryBSD is a back to basics lightweight desktop distribution based on stock FreeBSD.” It is basically FreeBSD with a desktop environment pre-configured and several apps preinstalled. The goal is to quickly get a FreeBSD-based system running on your computer. - -You might be thinking that this sounds a lot like a couple of other BSDs that are available, such as [NomadBSD][6] and [GhostBSD][7]. The major difference between those BSDs and FuryBSD is that FuryBSD is much closer to stock FreeBSD. For example, FuryBSD uses the FreeBSD installer, while others have created their own installers and utilities. - -As it states on the [site][8], “Although FuryBSD may resemble past graphical BSD projects like PC-BSD and TrueOS, FuryBSD is created by a different team and takes a different approach focusing on tight integration with FreeBSD. This keeps overhead low and maintains compatibility with upstream.” The lead dev also told me that “One key focus for FuryBSD is for it to be a small live media with a few assistive tools to test drivers for hardware.” - -Currently, you can go to the [FuryBSD homepage][3] and download either an XFCE or KDE LiveCD. A GNOME version is in the works. - -### Who’s is Behind FuryBSD? - -The lead dev behind FuryBSD is [Joe Maloney][9]. Joe has been a FreeBSD user for many years. He contributed to other BSD projects, such as PC-BSD. He also worked with Eric Turgeon, the creator of GhostBSD, to rewrite the GhostBSD LiveCD. Along the way, he picked up a better understanding of BSD and started to form an idea of how he would make a distribution on his own. - -Joe is joined by several other devs who have also spent many years in the BSD world, such as Jaron Parsons, Josh Smith, and Damian Szidiropulosz. - -### The Future for FuryBSD - -At the moment, FuryBSD is nothing more than a pre-configured FreeBSD setup. However, the devs have a [list of improvements][5] that they want to make going forward. These include: - - * A sane framework for loading, 3rd party proprietary drivers graphics, wireless - * Cleanup up the LiveCD experience a bit more to continue to make it more friendly - * Printing support out of box - * A few more default applications included to provide a complete desktop experience - * Integrated [ZFS][10] replication tools for backup and restore - * Live image persistence options - * A custom pkg repo with sane defaults - * Continuous integration for applications updates - * Quality assurance for FreeBSD on the desktop - * Tailored artwork, color scheming, and theming - * Directory services integration - * Security hardening - - - -The devs make it quite clear that any changes they make will have a lot of thought and research behind them. They don’t want to compliment a feature, only to have to remove it or change it when it breaks something. - -![FuryBSD desktop][11] - -### How You Can Help FuryBSD? - -At this moment the project is still very young. Since all projects need help to survive, I asked Joe what kind of help they were looking for. He said, “We could use help [answering questions on the forums][12], [GitHub][13] tickets, help with documentation are all needed.” He also said that if people wanted to add support for other desktop environments, pull requests are welcome. - -### Final Thoughts - -Although I have not tried it yet, I have a good feeling about FuryBSD. It sounds like the project is in capable hands. Joe Maloney has been thinking about how to make the best BSD desktop experience for over a decade. Unlike majority of Linux distros that are basically a rethemed Ubuntu, the devs behind FuryBSD know what they are doing and they are choosing quality over the fancy bells and whistles. - -What are your thoughts on this new entry into the every growing desktop BSD market? Have you tried out FuryBSD or will you give it a try? Please 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][14]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/furybsd/ - -作者:[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://itsfoss.com/hyperbola-linux-bsd/ -[2]: https://itsfoss.com/bsd/ -[3]: https://www.furybsd.org/ -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/fury-bsd.jpg?ssl=1 -[5]: https://www.furybsd.org/manifesto/ -[6]: https://itsfoss.com/nomadbsd/ -[7]: https://ghostbsd.org/ -[8]: https://www.furybsd.org/furybsd-video-overview-at-knoxbug/ -[9]: https://github.com/pkgdemon -[10]: https://itsfoss.com/what-is-zfs/ -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/FuryBSDS-desktop.jpg?resize=800%2C450&ssl=1 -[12]: https://forums.furybsd.org/ -[13]: https://github.com/furybsd -[14]: https://reddit.com/r/linuxusersgroup diff --git a/translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md b/translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md new file mode 100644 index 0000000000..f2ea410bf7 --- /dev/null +++ b/translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Meet FuryBSD: A New Desktop BSD Distribution) +[#]: via: (https://itsfoss.com/furybsd/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +认识 FuryBSD:一个新的桌面 BSD 发行版 +====== + +在过去的几个月中,出现了一些新的桌面 BSD。之前有 [HyperbolaBSD,它是 Hyperbola GNU/Linux][1]。[BSD][2] 世界中的另一个新入者是 [FuryBSD][3]。 + +### FuryBSD:一个新的BSD发行版 + +![][4] + +从本质上讲,FuryBSD 是一个非常简单的发行版。根据[它的网站][5]:“FuryBSD 一个是基于 FreeBSD 的轻量级桌面发行版。” 它基本上是预配置了桌面环境,并预安装了多个应用的 FreeBSD。目标是在快速地你的计算机上运行基于 FreeBSD 的系统。 + +你可能会认为这听起来很像其他几个已有的 BSD,例如 [NomadBSD][6] 和 [GhostBSD][7]。这些 BSD 与 FuryBSD 之间的主要区别在于 FuryBSD 与现有的 FreeBSD 更加接近。例如,FuryBSD 使用 FreeBSD 安装程序,而其他发行版则用了自己的安装程序和工具。 + +正如[[它的网站][8]所说:“尽管 FuryBSD 可能类似于 PC-BSD 和 TrueOS 等图形化 BSD 项目,但 FuryBSD 是由不同的团队创建的,并且采用了与 FreeBSD 紧密集成的不同方法。这样可以降低开销,并保持与上游的兼容性。”开发领导还告诉我:“FuryBSD 的一个主要重点是使其成为一种小型 Live 媒体,并带有一些辅助工具来测试硬件驱动程序。” + +当前,你可以进入 [FuryBSD 主页][3]并下载 XFCE 或 KDE LiveCD。GNOME 版本正在开发中。 + +### FuryBSD 的背后是谁 + +FuryBSD 的主要开发者是 [Joe Maloney][9]。Joe 多年来一直是 FreeBSD 的用户。他为 PC-BSD 等其他 BSD 项目做出了贡献。他还与 GhostBSD 的创建者 Eric Turgeon 一起重写了 GhostBSD LiveCD。在此过程中,他对 BSD 有了更好的了解,并开始形成自己如何进行发行的想法。 + +Joe 与其他参与 BSD 世界多年的开发者一起加入了开发,例如 Jaron Parsons、Josh Smith 和 Damian Szidiropulosz。 + +### FuryBSD 的未来 + +目前,FuryBSD 仅仅是预配置的 FreeBSD。但是,开发者有一份[要改进的清单][5]。包括: + +* 可靠的加载框架、第三方专有图形驱动、无线 +* 进一步整理 LiveCD 体验,以使其更加友好 +* 开箱即用的打印支持 +* 包含更多默认应用,以提供完整的桌面体验 +* 集成的 [ZFS][10] 复制工具,用于备份和还原 +* Live 镜像持久化选项 +* 默认自定义 pkg 仓库 +* 用于应用更新的持续集成 +* 桌面 FreeBSD 的质量保证 +* 自定义、色彩方案和主题 +* 目录服务集成 +* 安全加固 + + + +开发者非常清楚地表明,他们所做的任何更改都需要大量的思考和研究。他们不会赞美某个功能,只会在它破坏一些东西时删除或者修改它。 + +![FuryBSD desktop][11] + +### 你可以如何帮助 FuryBSD? + +目前,该项目还很年轻。由于所有项目都需要帮助才能生存,所以我问 Joe 他们正在寻求什么样的帮助。他说:“我们可以帮助[在论坛上回答问题][12]、回答 [GitHub][13] 上的问题,完善文档。”他还说如果人们想增加对其他桌面环境的支持,欢迎发起拉取请求。 + +### 最后的想法 + +尽管我还没有尝试过,但是我对 FuryBSD 感觉不错。听起来项目在掌握中。十多年来,Joe Maloney 一直在思考如何达到最佳的 BSD 桌面体验。与大多数 Linux 发行版基本上都是经过重新设计的 Ubuntu 不同,FuryBSD 背后的开发者知道他们在做什么,并且他们在更看重质量而不是花哨的功能。 + +你对这个在不断增长的桌面 BSD 市场的新入者怎么看?你尝试过 FuryBSD 或者会尝试一下吗?请在下面的评论中告诉我们。 + +如果你觉得这篇文章有趣,请在 Hacker News 或 [Reddit][14] 等社交媒体上分享它。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/furybsd/ + +作者:[John Paul][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/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/hyperbola-linux-bsd/ +[2]: https://itsfoss.com/bsd/ +[3]: https://www.furybsd.org/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/fury-bsd.jpg?ssl=1 +[5]: https://www.furybsd.org/manifesto/ +[6]: https://itsfoss.com/nomadbsd/ +[7]: https://ghostbsd.org/ +[8]: https://www.furybsd.org/furybsd-video-overview-at-knoxbug/ +[9]: https://github.com/pkgdemon +[10]: https://itsfoss.com/what-is-zfs/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/FuryBSDS-desktop.jpg?resize=800%2C450&ssl=1 +[12]: https://forums.furybsd.org/ +[13]: https://github.com/furybsd +[14]: https://reddit.com/r/linuxusersgroup \ No newline at end of file From 31d59909bbc61e496f2b90d80e1ec81e3e1c7a14 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 20 Feb 2020 08:32:13 +0800 Subject: [PATCH 013/260] translating --- .../20200219 How to Install Latest Git Version on Ubuntu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md b/sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md index ef76a58b66..55ab72d565 100644 --- a/sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md +++ b/sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5d1b62251fa1588ccf1519e53be17c2e4c01ff22 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 20 Feb 2020 09:40:17 +0800 Subject: [PATCH 014/260] Rename sources/tech/20200219 Fedora at the Czech National Library of Technology.md to sources/talk/20200219 Fedora at the Czech National Library of Technology.md --- ...20200219 Fedora at the Czech National Library of Technology.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200219 Fedora at the Czech National Library of Technology.md (100%) diff --git a/sources/tech/20200219 Fedora at the Czech National Library of Technology.md b/sources/talk/20200219 Fedora at the Czech National Library of Technology.md similarity index 100% rename from sources/tech/20200219 Fedora at the Czech National Library of Technology.md rename to sources/talk/20200219 Fedora at the Czech National Library of Technology.md From bbe69234d94a9ac61827c7fd7ae9c9b198f12a86 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 20 Feb 2020 10:21:39 +0800 Subject: [PATCH 015/260] PRF @chai-yuan --- ...ur Fedora Terminal with MPD and ncmpcpp.md | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/translated/tech/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md b/translated/tech/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md index 4940c656a1..df5c5c96fe 100644 --- a/translated/tech/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md +++ b/translated/tech/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md @@ -1,30 +1,30 @@ [#]: collector: (lujun9972) [#]: translator: (chai-yuan) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Playing Music on your Fedora Terminal with MPD and ncmpcpp) [#]: via: (https://fedoramagazine.org/playing-music-on-your-fedora-terminal-with-mpd-and-ncmpcpp/) [#]: author: (Carmine Zaccagnino https://fedoramagazine.org/author/carzacc/) -使用MPD和ncmpcpp在你的Fedora终端上播放音乐 +在你的 Fedora 终端上播放音乐 ====== ![][1] -MPD(Music Playing Daemon),顾名思义,是一个音乐(Music)播放(Playing)程序(Daemon)。它可以播放音乐,并且作为一个守护进程,任何软件都可以与之交互并播放声音,包括一些CLI客户端。 +MPD(Music Playing Daemon),顾名思义,是一个音乐(Music)播放(Playing)守护进程(Daemon)。它可以播放音乐,并且作为一个守护进程,任何软件都可以与之交互并播放声音,包括一些 CLI 客户端。 -其中一个被称为 _ncmpcpp_ ,它是对之前NNCMPCI工具的改进。名字的变化与他们所写的语言没有太大关系:都是C++,但称为 _ncmpcpp_ ,因为它是 _NCurses Music Playing Client_ _Plus Plus_ . +其中一个被称为 `ncmpcpp`,它是对之前 `ncmpc` 工具的改进。名字的变化与编写它们的语言没有太大关系:都是 C++,而之所以被称为 `ncmpcpp`,因为它是 “NCurses Music Playing Client Plus Plus”。 缘故 ### 安装 MPD 和 ncmpcpp - _ncmpmpcc_ 的客户端可以从官方Fedora库中通过dnf命令直接安装. +`ncmpmpcc` 的客户端可以从官方 Fedora 库中通过 `dnf` 命令直接安装。 ``` $ sudo dnf install ncmpcpp ``` -另一方面,MPD必须从RPMFusion free库安装,你可以通过运行: +另一方面,MPD 必须从 RPMFusion free 库安装,你可以通过运行: ``` $ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm @@ -38,11 +38,11 @@ $ sudo dnf install mpd ### 配置并启用 MPD -设置MPD最简单的方法是以普通用户的身份运行它。默认情况是以专用 _mpd_ 用户的身份运行它,但这会导致各种权限问题。 +设置 MPD 最简单的方法是以普通用户的身份运行它。默认情况是以专用 `mpd` 用户的身份运行它,但这会导致各种权限问题。 在运行它之前,我们需要创建一个本地配置文件,允许我们作为普通用户运行。 -首先创建一个名叫 _mpd_ 的目录在 _~/.config_ 里: +首先在 `~/.config` 里创建一个名叫 `mpd` 的目录: ``` $ mkdir ~/.config/mpd @@ -54,13 +54,13 @@ $ mkdir ~/.config/mpd $ cp /etc/mpd.conf ~/.config/mpd ``` -然后用 _vim_, _nano_ 或 _gedit_之类的软件编辑它: +然后用 `vim`、`nano` 或 `gedit` 之类的软件编辑它: ``` $ nano ~/.config/mpd/mpd.conf ``` -我建议您通读所有内容,检查是否有任何需要做的事情,但对于大多数设置,您可以删除所有内容,只需保留以下内容: +我建议你通读所有内容,检查是否有任何需要做的事情,但对于大多数设置你都可以删除,只需保留以下内容: ``` db_file "~/.config/mpd/mpd.db" @@ -73,7 +73,7 @@ log_file "syslog" $ mpd ``` -没有报错,这将在后台启动MPD守护进程。 +没有报错,这将在后台启动 MPD 守护进程。 ### 使用 ncmpcpp @@ -83,23 +83,23 @@ $ mpd $ ncmpcpp ``` -您将在终端中看到一个由ncurses所支持的图形用户界面。 +你将在终端中看到一个由 ncurses 所支持的图形用户界面。 -按下 _4_ 键,然后就可以看到本地的音乐目录,用方向键进行选择并按下 _Enter_ 进行播放。 +按下 `4` 键,然后就可以看到本地的音乐目录,用方向键进行选择并按下回车进行播放。 -多播放几次就会创建一个 _playlist_, 让你可以使用 _>_ 键(不是右箭头, _>_ 是右尖括号) 移动到下一首,并使用 _<_ 返回上一首. + 和 – 键可以调节音量. _Q_ 键可以让你退出 ncmpcpp 但不停止播放音乐. 你可以按下 _P_ 来控制暂停和播放. +多播放几个歌曲就会创建一个*播放列表*,让你可以使用 `>` 键(不是右箭头, 是右尖括号)移动到下一首,并使用 `<` 返回上一首。`+` 和 `–` 键可以调节音量。`Q` 键可以让你退出 `ncmpcpp` 但不停止播放音乐。你可以按下 `P` 来控制暂停和播放。 -你可以按下 _1_ 键来查看当前播放列表 (这是默认的视图). 从这个视图中,您可以按 _i_ 查看有关当前歌曲的信息(标记)。按 _6_ 可更改当前歌曲的标记。 +你可以按下 `1` 键来查看当前播放列表(这是默认的视图)。从这个视图中,你可以按 `i` 查看有关当前歌曲的信息(标签)。按 `6` 可更改当前歌曲的标签。 -按 _\_ 按钮将在视图顶部添加(或删除)信息面板。在左上角,你可以看到如下的内容: +按 `\` 按钮将在视图顶部添加(或删除)信息面板。在左上角,你可以看到如下的内容: ``` [------] ``` -按下 _r_, _z_, _y_, _R_, _x_ 将会分别切换到 _repeat_, _random_, _single_, _consume_ 和 _crossfade_ 播放模式并将小指示器中的 _–_ 字符替换为选定模式. +按下 `r`、`z`、`y`、`R`、`x` 将会分别切换到 `repeat`、`random`、`single`、`consume` 和 `crossfade` 等播放模式,并将这个小指示器中的 `–` 字符替换为选定模式。 -按下 _F1_ 键将会显示一些帮助文档,包含一系列的键绑定列表, 因此无需在此处编写完整列表。所以继续吧!做一个极客, 在你的终端上播放音乐! +按下 `F1` 键将会显示一些帮助文档,包含一系列的键绑定列表,因此无需在此处列出完整列表。所以继续吧!做一个极客,在你的终端上播放音乐! -------------------------------------------------------------------------------- @@ -108,7 +108,7 @@ via: https://fedoramagazine.org/playing-music-on-your-fedora-terminal-with-mpd-a 作者:[Carmine Zaccagnino][a] 选题:[lujun9972][b] 译者:[chai-yuan](https://github.com/chai-yuan) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3f31024a9a7f32a781782ca85e8f27a8eb1c575d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 20 Feb 2020 10:22:25 +0800 Subject: [PATCH 016/260] PUB @chai-yuan https://linux.cn/article-11909-1.html --- ...ying Music on your Fedora Terminal with MPD and ncmpcpp.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md (98%) diff --git a/translated/tech/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md b/published/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md similarity index 98% rename from translated/tech/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md rename to published/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md index df5c5c96fe..b78452578b 100644 --- a/translated/tech/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md +++ b/published/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chai-yuan) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11909-1.html) [#]: subject: (Playing Music on your Fedora Terminal with MPD and ncmpcpp) [#]: via: (https://fedoramagazine.org/playing-music-on-your-fedora-terminal-with-mpd-and-ncmpcpp/) [#]: author: (Carmine Zaccagnino https://fedoramagazine.org/author/carzacc/) From a18ce8946274da821cffe503122c26b73c9d5aa6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 21 Feb 2020 01:04:22 +0800 Subject: [PATCH 017/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200219=20How=20?= =?UTF-8?q?Kubernetes=20Became=20the=20Standard=20for=20Compute=20Resource?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md --- ...came the Standard for Compute Resources.md | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md diff --git a/sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md b/sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md new file mode 100644 index 0000000000..9e12b778c6 --- /dev/null +++ b/sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md @@ -0,0 +1,49 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Kubernetes Became the Standard for Compute Resources) +[#]: via: (https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compute-resources/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +How Kubernetes Became the Standard for Compute Resources +====== + + + +2019 has been a game-changing year for the cloud-native ecosystem. There were [consolidations][1], acquisitions of powerhouses like Red Hat Docker and Pivotal, and the emergence of players like Rancher Labs and Mirantis. + +“All these consolidation and M&A in this space is an indicator of how fast the market has matured,” said Sheng Liang, co-founder and CEO of Rancher Labs, a company that offers a complete software stack for teams adopting containers. + +Traditionally, emerging technologies like Kubernetes and Docker appeal to tinkerers and mega-scalers such as Facebook and Google. There was very little interest outside of that group. However, both of these technologies experienced massive adoption at the enterprise level. Suddenly, there was a massive market with huge opportunities. Almost everyone jumped in. There were players who were bringing innovative solutions and then there were players who were trying to catch up with the rest. It became very crowded very quickly. + +It also changed the way innovation was happening. [Early adopters were usually tech-savvy companies.][2] Now, almost everyone is using it, even in areas that were not considered turf for Kubernetes. It changed the market dynamics as companies like Rancher Labs were witnessing unique use cases. + +Liang adds, “I’ve never been in a market or technology evolution that’s happened as quickly and as dynamically as Kubernetes. When we started some five years ago, it was a very crowded space. Over time, most of our peers disappeared for one reason or the other. Either they weren’t able to adjust to the change or they chose not to adjust to some of the changes.” + +In the early days of Kubernetes, the most obvious opportunity was to build Kubernetes distro and Kubernetes operations. It’s new technology. It’s known to be reasonably complex to install, upgrade, and operate. + +It all changed when Google, AWS, and Microsoft entered the market. At that point, there was a stampede of vendors rushing in to provide solutions for the platform. “As soon as cloud providers like Google decided to make Kubernetes as a service and offered it for free as loss-leader to drive infrastructure consumption, we knew that the business of actually operating and supporting Kubernetes, the upside of that would be very limited,” said Liang. + +Not everything was bad for non-Google players. Since cloud vendors removed all the complexity that came with Kubernetes by offering it as a service, it meant wider adoption of the technology, even by those who refrained from using it due to the overhead of operating it. It meant that Kubernetes would become ubiquitous and would become an industry standard. + +“Rancher Labs was one of the very few companies that saw this as an opportunity and looked one step further than everyone else. We realized that Kubernetes was going to become the new computing standard, just the way TCP/IP became the networking standard,” said Liang. + +CNCF plays a critical role in building a vibrant ecosystem around Kubernetes, creating a massive community to build, nurture and commercialize cloud-native open source technologies. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compute-resources/ + +作者:[Swapnil Bhartiya][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/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.cloudfoundry.org/blog/2019-is-the-year-of-consolidation-why-ibms-deal-with-red-hat-is-a-harbinger-of-things-to-come/ +[2]: https://www.packet.com/blog/open-source-season-on-the-kubernetes-highway/ From 7f1750d5c8b26c6adf1f12b37059fb01122cc89f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 21 Feb 2020 01:05:34 +0800 Subject: [PATCH 018/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200220=20Using?= =?UTF-8?q?=20Python=20and=20GNU=20Octave=20to=20plot=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200220 Using Python and GNU Octave to plot data.md --- ...sing Python and GNU Octave to plot data.md | 720 ++++++++++++++++++ 1 file changed, 720 insertions(+) create mode 100644 sources/tech/20200220 Using Python and GNU Octave to plot data.md diff --git a/sources/tech/20200220 Using Python and GNU Octave to plot data.md b/sources/tech/20200220 Using Python and GNU Octave to plot data.md new file mode 100644 index 0000000000..6c59d38eda --- /dev/null +++ b/sources/tech/20200220 Using Python and GNU Octave to plot data.md @@ -0,0 +1,720 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Python and GNU Octave to plot data) +[#]: via: (https://opensource.com/article/20/2/python-gnu-octave-data-science) +[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) + +Using Python and GNU Octave to plot data +====== +Learn how to do a common data science task with Python and GNU Octave. +![Analytics: Charts and Graphs][1] + +Data science is a domain of knowledge that spans programming languages. Some are well-known for solving problems in this space, while others are lesser-known. This article will help you become familiar with doing data science with some popular languages. + +### Choosing Python and GNU Octave for data science + +Every so often, I try to learn a new programming language. Why? It is mostly a combination of boredom with the old ways and curiosity about the new ways. When I started programming, the only language I knew was C. Life was hard and dangerous in those years, as I had to manually allocate memory, manage pointers, and remember to free memory. + +Then a friend suggested I try Python, and life became much easier. Programs became much slower, but I did not have to suffer through writing analysis software. However, I soon realized that each language was more suitable than others for some applications. I later studied some other languages, and each one brought some new bit of enlightenment. Discovering new programming styles let me backport some solutions to other languages, and everything became much more interesting. + +To get a feeling for a new programming language (and its documentation), I always start by writing some example programs that perform a task I know well. To that ends, I will explain how to write a program in Python and GNU Octave for a particular task you could classify as data science. If you are already familiar with one of the languages, start with that one and go through the others to look for similarities and differences. It is not intended to be an exhaustive comparison of the languages, just a little showcase. + +All of the programs are meant to be run on the [command line][2], not with a [graphical user interface][3] (GUI). The full examples are available in the [polyglot_fit repository][4]. + +### The programming task + +The program you will write in this series: + + * Reads data from a [CSV file][5] + * Interpolates the data with a straight line (i.e., _f(x)=m ⋅ x + q_) + * Plots the result to an image file + + + +This is a common situation that many data scientists have encountered. The example data is the first set of [Anscombe's quartet][6], shown in the table below. This is a set of artificially constructed data that gives the same results when fitted with a straight line, but their plots are very different. The data file is a text file with tabs as column separators and a few lines as a header. This task will use only the first set (i.e., the first two columns). + +[**Anscombe's quartet**][6] + +I + +II + +III + +IV + +x + +y + +x + +y + +x + +y + +x + +y + +10.0 + +8.04 + +10.0 + +9.14 + +10.0 + +7.46 + +8.0 + +6.58 + +8.0 + +6.95 + +8.0 + +8.14 + +8.0 + +6.77 + +8.0 + +5.76 + +13.0 + +7.58 + +13.0 + +8.74 + +13.0 + +12.74 + +8.0 + +7.71 + +9.0 + +8.81 + +9.0 + +8.77 + +9.0 + +7.11 + +8.0 + +8.84 + +11.0 + +8.33 + +11.0 + +9.26 + +11.0 + +7.81 + +8.0 + +8.47 + +14.0 + +9.96 + +14.0 + +8.10 + +14.0 + +8.84 + +8.0 + +7.04 + +6.0 + +7.24 + +6.0 + +6.13 + +6.0 + +6.08 + +8.0 + +5.25 + +4.0 + +4.26 + +4.0 + +3.10 + +4.0 + +5.39 + +19.0 + +12.50 + +12.0 + +10.84 + +12.0 + +9.13 + +12.0 + +8.15 + +8.0 + +5.56 + +7.0 + +4.82 + +7.0 + +7.26 + +7.0 + +6.42 + +8.0 + +7.91 + +5.0 + +5.68 + +5.0 + +4.74 + +5.0 + +5.73 + +8.0 + +6.89 + +### The Python way + +[Python][7] is a general-purpose programming language that is among the most popular languages in use today (as evidenced by findings from the [TIOBE index][8], [RedMonk Programming Language Rankings][9], [Popularity of Programming Language Index][10], [State of the Octoverse of GitHub][11], and other sources). It is an [interpreted language][12]; therefore, the source code is read and evaluated by a program that executes the instructions. It has a comprehensive [standard library][13] and is generally very pleasant to use (I have no reference for this last statement; it is just my humble opinion). + +#### Installation + +To develop with Python, you need the interpreter and a few libraries. The minimum requirements are: + + * [NumPy][14] for convenient array and matrices manipulation + * [SciPy][15] for scientific calculations + * [Matplotlib][16] for plotting + + + +Installing them in [Fedora][17] is easy: + + +``` +`sudo dnf install python3 python3-numpy python3-scipy python3-matplotlib` +``` + +#### Commenting code + +In Python, [comments][18] are achieved by putting a **#** at the beginning of the line, and the rest of the line will be discarded by the interpreter: + + +``` +`# This is a comment ignored by the interpreter.` +``` + +The [fitting_python.py][19] example uses comments to insert licensing information in the source code, and the first line is a [special comment][20] that enables the script to be executed on the command line: + + +``` +`#! /usr/bin/env python3` +``` + +This line informs the command-line interpreter that the script needs to be executed by the program **python3**. + +#### Required libraries + +Libraries and modules can be imported in Python as an object (as in the first line in the example) with all the functions and members of the library. There is a convenient option to rename them with a custom label by using the **as** specification: + + +``` +import numpy as np +from scipy import stats +import matplotlib.pyplot as plt +``` + +You may also decide to import only a submodule (as in the second and third lines). The syntax has two (more or less) equivalent options: **import module.submodule** and **from module import submodule**. + +#### Defining variables + +Python's variables are declared the first time a value is assigned to them: + + +``` +input_file_name = "anscombe.csv" +delimiter = "\t" +skip_header = 3 +column_x = 0 +column_y = 1 +``` + +The variable types are inferred by the value that is assigned to the variable. There are no variables with constant values unless they are declared in a module and can only be read. Idiomatically, variables that should not be modified should be named in uppercase. + +#### Printing output + +Running the programs through the command line means that the output is just printed on the terminal. Python has the [**print()**][21] function that, by default, prints its argument and adds a newline at the end of the output: + + +``` +`print("#### Anscombe's first set with Python ####")` +``` + +It is possible to combine the **print()** function with the [formatting power][22] of the [string class][23] in Python. Strings have the **format** method that can be used to add some formatted text to the string itself. For instance, it is possible to add a formatted float number, e.g.: + + +``` +`print("Slope: {:f}".format(slope))` +``` + +#### Reading data + +Reading CSV files is very easy with NumPy and the function [**genfromtxt()**][24], which generates a [NumPy array][25]: + + +``` +`data = np.genfromtxt(input_file_name, delimiter = delimiter, skip_header = skip_header)` +``` + +In Python, a function can have a variable number of arguments, and you can have it pass a subset by specifying the desired ones. Arrays are very powerful matrix-like objects that can be easily sliced into smaller arrays: + + +``` +x = data[:, column_x] +y = data[:, column_y] +``` + +The colons select the whole range, and they can also be used to select a subrange. For instance, to select the first two rows of the array, you would use: + + +``` +`first_two_rows = data[0:1, :]` +``` + +#### Fitting data + +SciPy provides convenient functions for data fitting, such as the [**linregress()**][26] function. This function provides some significant values related to the fit, such as the slope, intercept, and the correlation coefficient of the two datasets: + + +``` +slope, intercept, r_value, p_value, std_err = stats.linregress(x, y) + +print("Slope: {:f}".format(slope)) +print("Intercept: {:f}".format(intercept)) +print("Correlation coefficient: {:f}".format(r_value)) +``` + +Since **linregress()** provides several pieces of information, the result can be saved to several variables at the same time. + +#### Plotting + +The Matplotlib library plots only data points; therefore, you should define the points you want to plot. The **x** and **y** arrays were already defined, so you can directly plot them, but you also need data points that will represent the straight line. + + +``` +`fit_x = np.linspace(x.min() - 1, x.max() + 1, 100)` +``` + +The [**linspace()**][27] function conveniently generates a set of equally spaced values between two values. The ordinates can be easily calculated by exploiting the powerful NumPy arrays, which can be used in a formula as if they were ordinary numeric variables: + + +``` +`fit_y = slope * fit_x + intercept` +``` + +The formula is applied element-by-element on the array; therefore, the result has the same number of entries in the initial array. + +To create the plot, first, define a [figure object][28] that will contain all the graphics: + + +``` +fig_width = 7 #inch +fig_height = fig_width / 16 * 9 #inch +fig_dpi = 100 + +fig = plt.figure(figsize = (fig_width, fig_height), dpi = fig_dpi) +``` + +Several plots can be drawn on a figure; in Matplotlib, the plots are called [axes][29]. This example defines a single axis object to plot the data points: + + +``` +ax = fig.add_subplot(111) + +ax.plot(fit_x, fit_y, label = "Fit", linestyle = '-') +ax.plot(x, y, label = "Data", marker = '.', linestyle = '') + +ax.legend() +ax.set_xlim(min(x) - 1, max(x) + 1) +ax.set_ylim(min(y) - 1, max(y) + 1) +ax.set_xlabel('x') +ax.set_ylabel('y') +``` + +Save the figure to a [PNG image file][30] with: + + +``` +`fig.savefig('fit_python.png')` +``` + +If you want to display (instead of saving) the plot, call: + + +``` +`plt.show()` +``` + +This example references all the objects used in the plotting section: it defines the object **fig** and the object **ax**. This technicality is not necessary, as the **plt** object can be used directly to plot the datasets. The [Matplotlib tutorial][31] shows an interface such as: + + +``` +`plt.plot(fit_x, fit_y)` +``` + +Frankly, I do not like this approach because it hides the non-trivial interactions that happen between the various objects. Unfortunately, sometimes the [official examples][32] are a bit confusing because they tend to use different approaches. Referencing graphical objects is not necessary in this simple example, but it becomes important in more complex ones (such as when embedding plots in GUIs). + +#### Results + +The output on the command line is: + + +``` +#### Anscombe's first set with Python #### +Slope: 0.500091 +Intercept: 3.000091 +Correlation coefficient: 0.816421 +``` + +Here is the image Matplotlib generates. + +![Plot and fit of the dataset obtained with Python][33] + +### The GNU Octave way + +The [GNU Octave][34] language is primarily intended for numerical computations. It offers a simple syntax for manipulating vectors and matrices and has some powerful plotting facilities. It is an interpreted language like Python. Since Octave's syntax is [mostly compatible][35] with [MATLAB][36], it is often described as a free alternative to MATLAB. Octave is not listed among the most popular programming languages, but MATLAB is, so Octave is rather popular in a sense. MATLAB predates NumPy, and I have the feeling that it was inspired by the former. While you go through the example, you will see the analogies. + +#### Installation + +The [fitting_octave.m][37] example only needs the basic Octave package, making the installation in Fedora rather simple: + + +``` +`sudo dnf install octave` +``` + +#### Commenting code + +In Octave, you can add comments to code with the percent symbol (**%**), and you can also use **#** if MATLAB compatibility is not needed. The option to use **#** allows you to write the same special comment line from the Python example to execute the script directly on the command line. + +#### Necessary libraries + +Everything used in this example is contained in the basic package, so you do not need to load any new libraries. If you need a library, the [syntax][38] is **pkg load module**. This command adds the module's functions to the list of available functions. In this regard, Python has more flexibility. + +#### Defining variables + +Variables are defined with pretty much the same syntax as Python: + + +``` +input_file_name = "anscombe.csv"; +delimiter = "\t"; +skip_header = 3; +column_x = 1; +column_y = 2; +``` + +Note that the end of the line has a semicolon; this is not necessary, but it suppresses the output of the results of the line. Without a semicolon, the interpreter would print the result of the expression: + + +``` +octave:1> input_file_name = "anscombe.csv" +input_file_name = anscombe.csv +octave:2> sqrt(2) +ans =  1.4142 +``` + +#### Printing output + +The powerful function [**printf()**][39] is used to print on the terminal. Unlike in Python, the **printf()** function does not automatically add a newline at the end of the printed string, so you have to add it. The first argument is a string that can contain format information for the other arguments to be passed to the function, such as: + + +``` +`printf("Slope: %f\n", slope);` +``` + +In Python, the formatting is built into the string itself, but in Octave, it is specific to the **printf()** function. + +#### Reading data + +The [**dlmread()**][40] function can read text files structured like CSV files: + + +``` +`data = dlmread(input_file_name, delimiter, skip_header, 0);` +``` + +The result is a [matrix][41] object, which is one of the fundamental data types in Octave. Matrices may be sliced with a syntax similar to Python: + + +``` +x = data(:, column_x); +y = data(:, column_y); +``` + +The fundamental difference is that the indexes start at one instead of zero. Therefore, in the example, the __x__ column is column number one. + +#### Fitting data + +To fit the data with a straight line, you can use the [**polyfit()**][42] function. It fits the input data with a polynomial, so you just need to use a polynomial of order one: + + +``` +p = polyfit(x, y, 1); + +slope = p(1); +intercept = p(2); +``` + +The result is a matrix with the polynomial coefficients; therefore, it selects the first two indexes. To determine the correlation coefficient, use the [**corr()**][43] function: + + +``` +`r_value = corr(x, y);` +``` + +Finally, print the results with the **printf()** function: + + +``` +printf("Slope: %f\n", slope); +printf("Intercept: %f\n", intercept); +printf("Correlation coefficient: %f\n", r_value); +``` + +#### Plotting + +As in the Matplotlib example, you first need to create a dataset that represents the fitted line: + + +``` +fit_x = linspace(min(x) - 1, max(x) + 1, 100); +fit_y = slope * fit_x + intercept; +``` + +The analogy with NumPy is also evident here, as it uses the [**linspace()**][44] function that behaves just like the Python's equivalent version. + +Again, as with Matplotlib, create a [figure][45] object first, then create an [axes][46] object to hold the plots: + + +``` +fig_width = 7; %inch +fig_height = fig_width / 16 * 9; %inch +fig_dpi = 100; + +fig = figure("units", "inches", +             "position", [1, 1, fig_width, fig_height]); + +ax = axes("parent", fig); + +set(ax, "fontsize", 14); +set(ax, "linewidth", 2); +``` + +To set properties of the axes object, use the [**set()**][47] function. The interface is rather confusing, though, as the function expects a comma-separated list of property and value pairs. These pairs are just a succession of a string representing the property name and a second object representing the value for that property. There are also other functions to set various properties: + + +``` +xlim(ax, [min(x) - 1, max(x) + 1]); +ylim(ax, [min(y) - 1, max(y) + 1]); +xlabel(ax, 'x'); +ylabel(ax, 'y'); +``` + +Plotting is achieved with the [**plot()**][48] function. The default behavior is that each call resets the axes, so you need to use the function [**hold()**][49]. + + +``` +hold(ax, "on"); + +plot(ax, fit_x, fit_y, +     "marker", "none", +     "linestyle", "-", +     "linewidth", 2); +plot(ax, x, y, +     "marker", ".", +     "markersize", 20, +     "linestyle", "none"); + +hold(ax, "off"); +``` + +Also, it is possible in the **plot()** function to add the property and value pairs. The [legend][50] must be created separately, and the labels should be stated manually: + + +``` +lg = legend(ax, "Fit", "Data"); +set(lg, "location", "northwest"); +``` + +Finally, save the output to a PNG image: + + +``` +image_size = sprintf("-S%f,%f", fig_width * fig_dpi, fig_height * fig_dpi); +image_resolution = sprintf("-r%f,%f", fig_dpi); + +print(fig, 'fit_octave.png', +      '-dpng', +      image_size, +      image_resolution); +``` + +Confusingly, in this case, the options are passed as a single string with the property name and the value. Since in Octave strings do not have the formatting facilities of Python, you must use the [**sprintf()**][51] function. It behaves just like the **printf()** function, but its result is not printed, rather it is returned as a string. + +In this example, as in the Python one, the graphical objects are referenced to keep their interactions evident. If Python's documentation in this regard is a little bit confusing, [Octave's documentation][52] is even worse. Most of the examples I found did not care about referencing the objects; instead, they rely on the fact that the plotting commands act on the currently active figure. A global [root graphics object][53] keeps track of the existing figures and axes. + +#### Results + +The resulting output on the command line is: + + +``` +#### Anscombe's first set with Octave #### +Slope: 0.500091 +Intercept: 3.000091 +Correlation coefficient: 0.816421 +``` + +And this shows the resulting image generated with Octave. + +![Plot and fit of the dataset obtained with Octave][54] + +### Next up + +Both Python and GNU Octave can plot the same information, though they differ in how they get there. If you're looking to explore other languages to complete similar tasks, I highly recommend looking at [Rosetta Code][55]. It's a marvelous resource to see how to solve the same problems in many languages.  + +What language do you like to plot data in? Share your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/python-gnu-octave-data-science + +作者:[Cristiano L. Fontana][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/cristianofontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) +[2]: https://en.wikipedia.org/wiki/Command-line_interface +[3]: https://en.wikipedia.org/wiki/Graphical_user_interface +[4]: https://gitlab.com/cristiano.fontana/polyglot_fit +[5]: https://en.wikipedia.org/wiki/Comma-separated_values +[6]: https://en.wikipedia.org/wiki/Anscombe%27s_quartet +[7]: https://www.python.org/ +[8]: https://www.tiobe.com/tiobe-index/ +[9]: https://redmonk.com/sogrady/2019/07/18/language-rankings-6-19/ +[10]: http://pypl.github.io/PYPL.html +[11]: https://octoverse.github.com/ +[12]: https://en.wikipedia.org/wiki/Interpreted_language +[13]: https://docs.python.org/3/library/ +[14]: https://numpy.org/ +[15]: https://www.scipy.org/ +[16]: https://matplotlib.org/ +[17]: https://getfedora.org/ +[18]: https://en.wikipedia.org/wiki/Comment_(computer_programming) +[19]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_python.py +[20]: https://en.wikipedia.org/wiki/Shebang_(Unix) +[21]: https://docs.python.org/3/library/functions.html#print +[22]: https://docs.python.org/3/library/string.html#string-formatting +[23]: https://docs.python.org/3/library/string.html +[24]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.genfromtxt.html +[25]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.array.html +[26]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.linregress.html +[27]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.linspace.html +[28]: https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure +[29]: https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes +[30]: https://en.wikipedia.org/wiki/Portable_Network_Graphics +[31]: https://matplotlib.org/tutorials/introductory/pyplot.html#sphx-glr-tutorials-introductory-pyplot-py +[32]: https://matplotlib.org/gallery/index.html +[33]: https://opensource.com/sites/default/files/uploads/fit_python.png (Plot and fit of the dataset obtained with Python) +[34]: https://www.gnu.org/software/octave/ +[35]: https://wiki.octave.org/FAQ#Differences_between_Octave_and_Matlab +[36]: https://en.wikipedia.org/wiki/MATLAB +[37]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_octave.m +[38]: https://octave.org/doc/v5.1.0/Using-Packages.html#Using-Packages +[39]: https://octave.org/doc/v5.1.0/Formatted-Output.html#XREFprintf +[40]: https://octave.org/doc/v5.1.0/Simple-File-I_002fO.html#XREFdlmread +[41]: https://octave.org/doc/v5.1.0/Matrices.html +[42]: https://octave.org/doc/v5.1.0/Polynomial-Interpolation.html +[43]: https://octave.org/doc/v5.1.0/Correlation-and-Regression-Analysis.html#XREFcorr +[44]: https://octave.sourceforge.io/octave/function/linspace.html +[45]: https://octave.org/doc/v5.1.0/Multiple-Plot-Windows.html +[46]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFaxes +[47]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFset +[48]: https://octave.org/doc/v5.1.0/Two_002dDimensional-Plots.html#XREFplot +[49]: https://octave.org/doc/v5.1.0/Manipulation-of-Plot-Windows.html#XREFhold +[50]: https://octave.org/doc/v5.1.0/Plot-Annotations.html#XREFlegend +[51]: https://octave.org/doc/v5.1.0/Formatted-Output.html#XREFsprintf +[52]: https://octave.org/doc/v5.1.0/Two_002dDimensional-Plots.html#Two_002dDimensional-Plots +[53]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFgroot +[54]: https://opensource.com/sites/default/files/uploads/fit_octave.png (Plot and fit of the dataset obtained with Octave) +[55]: http://www.rosettacode.org/ From b00530b2c005139eafe957e0bbd2f236316f0b39 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 21 Feb 2020 01:06:14 +0800 Subject: [PATCH 019/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200220=20Tools?= =?UTF-8?q?=20for=20SSH=20key=20management?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200220 Tools for SSH key management.md --- .../20200220 Tools for SSH key management.md | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 sources/tech/20200220 Tools for SSH key management.md diff --git a/sources/tech/20200220 Tools for SSH key management.md b/sources/tech/20200220 Tools for SSH key management.md new file mode 100644 index 0000000000..816993315c --- /dev/null +++ b/sources/tech/20200220 Tools for SSH key management.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tools for SSH key management) +[#]: via: (https://opensource.com/article/20/2/ssh-tools) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +Tools for SSH key management +====== +Time-saving shortcuts for a commonly used open source tool. +![collection of hardware on blue backround][1] + +I use SSH constantly. Every day I find myself logged in to multiple servers and Pis (both in the same room as me and over the internet). I have many devices I need access to, and different requirements for gaining access, so in addition to using various SSH/SCP command options, I have to maintain a config file with all the connection details. + +Over time I’ve come up with a few time-saving tips and tools that you might find useful, too. + +### SSH keys + +SSH keys are a way to authenticate SSH connections without using a password, either to speed up your access or as a security measure, if you turn password access off and ensure only authorized keys are permitted. To create an SSH key, run the command: + + +``` +`$ ssh-keygen` +``` + +This will create a key-pair (a public and private key) in **~/.ssh/**. Keep the private key (id_rsa) on the PC and never share it. You can share the public key (id_rsa.pub) with others or place it on other servers. + +### ssh-copy-id + +If I’m working on a Pi at home or work, I tend to leave SSH settings at their default, as I’m not concerned with security on an internal trusted network, and I usually copy my SSH key to the Pi to avoid having to authenticate with a password every time. To do this, I use the **ssh-copy-id** command to copy it to the Pi. This automatically adds your key to the Pi: + + +``` +`$ ssh-copy-id pi@192.168.1.20` +``` + +On production servers, I tend to turn off password authentication and only allow authorized SSH keys. + +### ssh-import-id + +Another similar tool is ssh-import-id. You can use this to give yourself (or others) access to a computer or server by importing their keys from GitHub. For example, I have registered my various SSH keys with my GitHub account, so I can push to GitHub without a password. These public keys are made available, so ssh-import-id can use them to authorize me from any of my computers: + + +``` +`$ ssh-import-id gh:bennuttall` +``` + +I can also use this to give someone else access to a server without asking them for their keys: + + +``` +`$ ssh-import-id gh:waveform80` +``` + +### storm + +I also use a tool called Storm, which helps you add SSH connections to your SSH config, so you don’t have to remember them all. You can install it with pip: + + +``` +`$ sudo pip3 install stormssh` +``` + +Then you can add an SSH connection to your config with the following command: + + +``` +`$ storm add pi3 pi@192.168.1.20` +``` + +Then you can just use **ssh pi3** to gain access. Similarly, **scp file.txt pi3:** or **sshfs pi pi3:** + +You can also use more SSH options, such as the port number: + + +``` +$ storm add pi3 pi@192.168.1.20:2000 +``` + +You can list, search, and edit saved connections easily using Storm’s [documentation][2]. All Storm actually does is manage items in your ssh config file at **~/.ssh/config**. Once you see how these are stored, you might choose to edit them manually. An example connection in config looks like this: + + +``` +Host pi3 +   user pi +   hostname 192.168.1.20 +   port 22 +``` + +### Conclusion + +SSH is an important tool for system administration, from Raspberry Pi to the largest cloud infrastructures. Familiarizing yourself with key management will forever be handy. Do you have other SSH tricks to add? I would love to have you share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/ssh-tools + +作者:[Ben Nuttall][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/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_BUS_Apple_520.png?itok=ZJu-hBV1 (collection of hardware on blue backround) +[2]: https://stormssh.readthedocs.io/en/stable/usage.html From 95ae0cafc4d57a9a217ac552500f80771a886517 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 21 Feb 2020 08:37:44 +0800 Subject: [PATCH 020/260] translated --- ...0 Scan Kubernetes for errors with KRAWL.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) rename {sources => translated}/tech/20200210 Scan Kubernetes for errors with KRAWL.md (80%) diff --git a/sources/tech/20200210 Scan Kubernetes for errors with KRAWL.md b/translated/tech/20200210 Scan Kubernetes for errors with KRAWL.md similarity index 80% rename from sources/tech/20200210 Scan Kubernetes for errors with KRAWL.md rename to translated/tech/20200210 Scan Kubernetes for errors with KRAWL.md index 5417ba630a..dae3043217 100644 --- a/sources/tech/20200210 Scan Kubernetes for errors with KRAWL.md +++ b/translated/tech/20200210 Scan Kubernetes for errors with KRAWL.md @@ -7,23 +7,23 @@ [#]: via: (https://opensource.com/article/20/2/kubernetes-scanner) [#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) -Scan Kubernetes for errors with KRAWL +使用 KRAWL 扫描 Kubernetes 错误 ====== -The KRAWL script identifies errors in Kubernetes pods and containers. +用 KRAWL 脚本来标识 Kubernetes pod 和容器中的错误。 ![Ship captain sailing the Kubernetes seas][1] -When you're running containers with Kubernetes, you often find that they pile up. This is by design. It's one of the advantages of containers: they're cheap to start whenever a new one is needed. You can use a front-end like OpenShift or OKD to manage pods and containers. Those make it easy to visualize what you have set up, and have a rich set of commands for quick interactions. +当你使用 Kubernetes 运行容器时,你通常会发现它们堆积。这是设计使然。它是容器的优点之一:每当需要新的容器时,它们启动成本都很低。你可以使用前端(如 OpenShift 或 OKD)来管理 pod 和容器。这些工具使可视化设置变得容易,并且它具有一组丰富的用于快速交互的命令。 -If a platform to manage containers doesn't fit your requirements, though, you can also get that information using only a Kubernetes toolchain, but there are a lot of commands you need for a full overview of a complex environment. For that reason, I wrote [KRAWL][2], a simple script that scans pods and containers under the namespaces on Kubernetes clusters and displays the output of events, if any are found. It can also be used as Kubernetes plugin for the same purpose. It's a quick and easy way to get a lot of useful information. +如果管理容器的平台不符合你的要求,你也可以仅使用 Kubernetes 工具链获取这些信息,但这需要大量命令才能全面了解复杂环境。出于这个原因,我编写了 [KRAWL][2],这是一个简单的脚本,可用于扫描 Kubernetes 集群命名空间下的 pod 和容器,并在发现任何事件时,显示事件的输出。它也可用作为 Kubernetes 插件使用。这是获取大量有用信息的快速简便方法。 -### Prerequisites +### 预先条件 - * You must have kubectl installed. - * Your cluster's kubeconfig must be either in its default location ($HOME/.kube/config) or exported (KUBECONFIG=/path/to/kubeconfig). + * 必须安装 kubectl。 + * 集群的 kubeconfig 配置必须在它的默认位置 ($HOME/.kube/config) 或已被导出。 -### Usage +### 使用 ``` @@ -32,7 +32,7 @@ If a platform to manage containers doesn't fit your requirements, though, you ca ![KRAWL script][3] -### The script +### 脚本 ``` @@ -201,7 +201,7 @@ get_pod_events * * * -_This was originally published as the README in [KRAWL's GitHub repository][2] and is reused with permission._ +_此文最初发布在 [KRAWL 的 GitHub 仓库][2]下的 README 中,并被或许重用。_ -------------------------------------------------------------------------------- @@ -209,7 +209,7 @@ via: https://opensource.com/article/20/2/kubernetes-scanner 作者:[Abhishek Tamrakar][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/) 荣誉推出 From 81db10b8b5ec982cd367aa7bbab8be8b5a1799dd Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 21 Feb 2020 08:43:32 +0800 Subject: [PATCH 021/260] translating --- sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md b/sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md index 34caf67f71..0b3d10a279 100644 --- a/sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md +++ b/sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From aedb3dddde7954912416ac68e513c775b01ee5e2 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 21 Feb 2020 11:07:12 +0800 Subject: [PATCH 022/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170918=20Fun=20?= =?UTF-8?q?and=20Games=20in=20Emacs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20170918 Fun and Games in Emacs.md --- .../tech/20170918 Fun and Games in Emacs.md | 234 ++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 sources/tech/20170918 Fun and Games in Emacs.md diff --git a/sources/tech/20170918 Fun and Games in Emacs.md b/sources/tech/20170918 Fun and Games in Emacs.md new file mode 100644 index 0000000000..64123ff680 --- /dev/null +++ b/sources/tech/20170918 Fun and Games in Emacs.md @@ -0,0 +1,234 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fun and Games in Emacs) +[#]: via: (https://www.masteringemacs.org/article/fun-games-in-emacs) +[#]: author: (Mickey Petersen https://www.masteringemacs.org/about) + +Fun and Games in Emacs +====== + +It’s yet another Monday and you’re hard at work on those [TPS reports][1] for your boss, Lumbergh. Why not play Emacs’s Zork-like text adventure game to take your mind off the tedium of work? + +But seriously, yes, there are both games and quirky playthings in Emacs. Some you have probably heard of or played before. The only thing they have in common is that most of them were added a long time ago: some are rather odd inclusions (as you’ll see below) and others were clearly written by bored employees or graduate students. What they all have in common is a whimsy and a casualness that I rarely see in Emacs today. Emacs is Serious Business now in a way that it probably wasn’t back in the 1980s when some of these games were written. + +### Tower of Hanoi + +The [Tower of Hanoi][2] is an ancient mathematical puzzle game and one that is probably familiar to some of us as it is often used in Computer Science as a teaching aid because of its recursive and iterative solutions. + +![Tower of Hanoi Screenshot](https://www.masteringemacs.org/static/uploads/hanoi.png) + +In Emacs there are three commands you can run to trigger the Tower of Hanoi puzzle: M-x hanoi with a default of 3 discs; M-x hanoi-unix and M-x hanoi-unix-64 uses the unix timestamp, making a move each second in line with the clock, and with the latter pretending it uses a 64-bit clock. + +The Tower of Hanoi implementation in Emacs dates from the mid 1980s — an awful long time ago indeed. There are a few Customize options (M-x customize-group RET hanoi RET) such as enabling colorized discs. And when you exit the Hanoi buffer or type a character you are treated to a sarcastic goodbye message (see above.) + +### 5x5 + +![5x5 game grid](https://www.masteringemacs.org/static/uploads/5x5.png) + The 5x5 game is a logic puzzle: you are given a 5x5 grid with a central cross already filled-in; your goal is to fill all the cells by toggling them on and off in the right order to win. It’s not as easy as it sounds! + +To play, type M-x 5x5, and with an optional digit argument you can change the size of the grid. What makes this game interesting is its rather complex ability to suggest the next move and attempt to solve the game grid. It uses Emacs’s very own, and very cool, symbolic RPN calculator M-x calc (and in [Fun with Emacs Calc][3] I use it to solve a simple problem.) + +So what I like about this game is that it comes with a very complex solver – really, you should read the source code with M-x find-library RET 5x5 – and a “cracker” that attempts to brute force solutions to the game. + +Try creating a bigger game grid, such as M-10 M-x 5x5, and then run one of the crack commands below. The crackers will attempt to iterate their way to the best solution. This runs in real time and is fun to watch: + + + +`M-x 5x5-crack-mutating-best` + Attempt to crack 5x5 by mutating the best solution. + +`M-x 5x5-crack-mutating-current` + Attempt to crack 5x5 by mutating the current solution. + +`M-x 5x5-crack-randomly` + Attempt to crack 5x5 using random solutions. + +`M-x 5x5-crack-xor-mutate` + Attempt to crack 5x5 by xoring the current and best solution. + +### Text Animation + +You can display a fancy birthday present animation by running M-x animate-birthday-present and giving it your name. It looks rather cool! + +![xkcd](https://imgs.xkcd.com/comics/real_programmers.png) + +The animate package is also used by M-x butterfly command, a command added to Emacs as an homage to the [XKCD][4] strip above. Of course the Emacs command in the strip is teeechnically not valid but the humor more than makes up for it. + +### Blackbox + +The objective of this game I am going to quote literally: + +> The object of the game is to find four hidden balls by shooting rays into the black box. There are four possibilities: 1) the ray will pass thru the box undisturbed, 2) it will hit a ball and be absorbed, 3) it will be deflected and exit the box, or 4) be deflected immediately, not even being allowed entry into the box. + +So, it’s a bit like the [Battleship][5] most of us played as kids but… for people with advanced degrees in physics? + +It’s another game that was added back in the 1980s. I suggest you read the extensive documentation on how to play by typing C-h f blackbox. + +### Bubbles + +![Bubbles game](https://www.masteringemacs.org/static/uploads/bubbles.png) + +The M-x bubbles game is rather simple: you must clear out as many “bubbles” as you can in as few moves as possible. When you remove bubbles the other bubbles drop and stick together. It’s a fun game that, as an added bonus, comes with graphics if you use Emacs’s GUI. It also works with your mouse. + +You can configure the difficulty of the game by calling M-x bubbles-set-game- where is one of: easy, medium, difficult, hard, or userdefined. Furthermore, you can alter the graphics, grid size and colors using Customize: M-x customize-group bubbles. + +For its simplicity and fun factor, this ranks as one of my favorite games in Emacs. + +### Fortune & Cookie + +I like the fortune command. Snarky, unhelpful and often sarcastic “advice” mixed in with literature and riddles brightens up my day whenever I launch a new shell. + +Rather confusingly there are two packages in Emacs that does more-or-less the same thing: fortune and cookie1. The former is geared towards putting fortune cookie messages in email signatures and the latter is just a simple reader for the fortune format. + +Anyway, to use Emacs’s cookie1 package you must first tell it where to find the file by customizing the variable cookie-file with customize-option RET cookie RET. + +If you’re on Ubuntu you will have to install the fortune package first. The files are found in the /usr/share/games/fortunes/ directory. + +You can then call M-x cookie or, should you want to do this, find all matching cookies with M-x cookie-apropos. + +### Decipher + +This package perfectly captures the utilitarian nature of Emacs: it’s a package to help you break simple substitution ciphers (like cryptogram puzzles) using a helpful user interface. You just know that – more than twenty years ago – someone really had a dire need to break a lot of basic ciphers. It’s little things like this module that makes me overjoyed to use Emacs: a module of scant importance to all but a few people and, yet, should you need it – there it is. + +So how do you use it then? Well, let’s consider the “rot13” cipher: rotating characters by 13 places in a 26-character alphabet. It’s an easy thing to try out in Emacs with M-x ielm, Emacs’s REPL for [Evaluating Elisp][6]: + +``` +*** Welcome to IELM *** Type (describe-mode) for help. +ELISP> (rot13 "Hello, World") +"Uryyb, Jbeyq" +ELISP> (rot13 "Uryyb, Jbeyq") +"Hello, World" +ELISP> +``` + +So how can the decipher module help us here? Well, create a new buffer test-cipher and type in your cipher text (in my case Uryyb, Jbeyq) + +![cipher](https://www.masteringemacs.org/static/uploads/cipher.png) + +You’re now presented with a rather complex interface. You can now place the point on any of the characters in the ciphertext on the purple line and guess what the character might be: Emacs will update the rest of the plaintext guess with your choices and tell you how the characters in the alphabet have been allocated thus far. + +You can then start winnowing down the options using various helper commands to help infer which cipher characters might correspond to which plaintext character: + + + +`D` + Shows a list of digrams (two-character combinations from the cipher) and their frequency + +`F` + Shows the frequency of each ciphertext letter + +`N` + Shows adjacency of characters. I am not entirely sure how this works. + +`M` and `R` + Save and restore a checkpoint, allowing you to branch your work and explore different ways of cracking the cipher. + +All in all, for such an esoteric task, this package is rather impressive! If you regularly solve cryptograms maybe this package can help? + +### Doctor + +![doctor](https://www.masteringemacs.org/static/uploads/doctor.png) + +Ah, the Emacs doctor. Based on the original [ELIZA][7] the “Doctor” tries to psychoanalyze what you say and attempts to repeat the question back to you. Rather fun, for a few minutes, and one of the more famous Emacs oddities. You can run it with M-x doctor. + +### Dunnet + +Emacs’s very own Zork-like text adventure game. To play it, type M-x dunnet. It’s rather good, if short, but it’s another rather famous Emacs game that too few have actually played through to the end. + +If you find yourself with time to kill between your TPS reports then it’s a great game with a built-in “boss screen” as it’s text-only. + +Oh, and, don’t try to eat the CPU card :) + +### Gomoku + +![gomoku](https://www.masteringemacs.org/static/uploads/gomoku.png) + +Another game written in the 1980s. You have to connect 5 squares, tic-tac-toe style. You can play against Emacs with M-x gomoku. The game also supports the mouse, which is rather handy. You can customize the group gomoku to adjust the size of the grid. + +### Game of Life + +[Conway’s Game of Life][8] is a famous example of cellular automata. The Emacs version comes with a handful of starting patterns that you can (programmatically with elisp) alter by adjusting the life-patterns variable. + +You can trigger a game of life with M-x life. The fact that the whole thing, display code, comments and all, come in at less than 300 characters is also rather impressive. + +### Pong, Snake and Tetris + +![tetris](https://www.masteringemacs.org/static/uploads/tetris.png) + +These classic games are all implemented using the Emacs package gamegrid, a generic framework for building grid-based games like Tetris and Snake. The great thing about the gamegrid package is its compatibility with both graphical and terminal Emacs: if you run Emacs in a GUI you get fancy graphics; if you don’t, you get simple ASCII art. + +You can run the games by typing M-x pong, M-x snake, or M-x tetris. + +The Tetris game in particular is rather faithfully implemented, having both gradual speed increase and the ability to slide blocks into place. And given you have the code to it, you can finally remove that annoying Z-shaped piece no one likes! + +### Solitaire + +![solitaire image](https://www.masteringemacs.org/static/uploads/solitaire.png) + +This is not the card game, unfortunately. But a peg-based game where you have to end up with just one stone on the board, by taking a stone (the o) and “jumping” over an adjacent stone into the hole (the .), removing the stone you jumped over in the process. Rinse and repeat until the board is empty. + +There is a handy solver built in called M-x solitaire-solve if you get stuck. + +### Zone + +Another of my favorites. This time’s it’s a screensaver – or rather, a series of screensavers. + +Type M-x zone and watch what happens to your screen! + +You can configure a screensaver idle time by running M-x zone-when-idle (or calling it from elisp) with an idle time in seconds. You can turn it off with M-x zone-leave-me-alone. + +This one’s guaranteed to make your coworkers freak out if it kicks off while they are looking. + +### Multiplication Puzzle + +![mpuz](https://www.masteringemacs.org/static/uploads/mpuz.png) + +This is another brain-twisting puzzle game. When you run M-x mpuz you are given a multiplication puzzle where you have to replace the letters with numbers and ensure the numbers add (multiply?) up. + +You can run M-x mpuz-show-solution to solve the puzzle if you get stuck. + +### Miscellaneous + +There are more, but they’re not the most useful or interesting: + +* You can translate a region into morse code with M-x morse-region and M-x unmorse-region. + +* The Dissociated Press is a very simple command that applies something like a random walk markov-chain generator to a body of text in a buffer and generates nonsensical text from the source body. Try it with M-x dissociated-press. + +* The Gamegrid package is a generic framework for building grid-based games. So far only Tetris, Pong and Snake use it. It’s called gamegrid. + +* The gametree package is a complex way of notating and tracking chess games played via email. + +* The M-x spook command inserts random words (usually into emails) designed to confuse/overload the “NSA trunk trawler” – and keep in mind this module dates from the 1980s and 1990s – with various words the spooks are supposedly listening for. Of course, even ten years ago that would’ve seemed awfully paranoid and quaint but not so much any more… + +### Conclusion + +I love the games and playthings that ship with Emacs. A lot of them date from, well, let’s just call a different era: an era where whimsy was allowed or perhaps even encouraged. Some are known classics (like Tetris and Tower of Hanoi) and some of the others are fun variations on classics (like blackbox) — and yet I love that they ship with Emacs after all these years. I wonder if any of these would make it into Emacs’s codebase today; well, they probably wouldn’t — they’d be relegated to the package manager where, in a clean and sterile world, they no doubt belong. + +There’s a mandate in Emacs to move things not essential to the Emacs experience to ELPA, the package manager. I mean, as a developer myself, that does make sense, but… surely for every package removed and exiled to ELPA we chip away the essence of what defines Emacs? + +-------------------------------------------------------------------------------- + + +via: https://www.masteringemacs.org/article/fun-games-in-emacs + +作者:[Mickey Petersen][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.masteringemacs.org/about +[b]:https://github.com/lujun9972 +[1]:https://en.wikipedia.org/wiki/Office_Space +[2]:https://en.wikipedia.org/wiki/Tower_of_Hanoi +[3]:https://www.masteringemacs.org/article/fun-emacs-calc +[4]:http://www.xkcd.com +[5]:https://en.wikipedia.org/wiki/Battleship_(game) +[6]:https://www.masteringemacs.org/article/evaluating-elisp-emacs +[7]:https://en.wikipedia.org/wiki/ELIZA +[8]:https://en.wikipedia.org/wiki/Conway's_Game_of_Life From 82fc982806d191924988b1bacb508bba5d43922b Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Fri, 21 Feb 2020 11:17:42 +0800 Subject: [PATCH 023/260] Update 20200219 How Kubernetes Became the Standard for Compute Resources.md --- ...ow Kubernetes Became the Standard for Compute Resources.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md b/sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md index 9e12b778c6..2ae6e33edd 100644 --- a/sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md +++ b/sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (heguangzhi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -38,7 +38,7 @@ via: https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compu 作者:[Swapnil Bhartiya][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[heguangzhi](https://github.com/heguangzhi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8abbbfb3515005322672dc9534c6e50a9a4878ab Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 21 Feb 2020 11:27:28 +0800 Subject: [PATCH 024/260] PRF @geekpi --- ...task list and access Reddit and Twitter.md | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/translated/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md b/translated/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md index 8a50dd6f14..c7c9be76c6 100644 --- a/translated/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md +++ b/translated/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use Vim to manage your task list and access Reddit and Twitter) @@ -9,12 +9,14 @@ 使用 Vim 管理任务列表和访问 Reddit 和 Twitter ====== -在我们的 20 个使用开源提升生产力的系列的第十七篇文章中了解在编辑器中处理待办列表以及获取社交信息。 -![Chat via email][1] + +> 在 2020 年用开源实现更高生产力的二十种方式的第十七篇文章中,了解在编辑器中处理待办列表以及获取社交信息。 + +![](https://img.linux.net.cn/data/attachment/album/202002/21/112633yf3mx8qlssltugzm.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 -### 使用 Vim 执行(几乎)所有操作,第 2 部分 +### 用 Vim 做(几乎)所有事情,第 2 部分 在[昨天的文章][2]中,你开始用 Vim 检查邮件和日历。今天,你可以做的更多。首先,你会在 Vim 编辑器中跟踪任务,然后获取社交信息。 @@ -24,13 +26,12 @@ 使用 Vim 编辑一个文本待办事件是一件自然的事,而 [todo.txt-vim][4] 包使其更加简单。首先安装 todo.txt-vim 包: - ``` -git clone ~/.vim/bundle/todo.txt-vim +git clone https://github.com/freitass/todo.txt-vim ~/.vim/bundle/todo.txt-vim vim ~/path/to/your/todo.txt ``` -todo.txt-vim 自动识别以 todo.txt 和 done.txt 结尾的文件作为 [todo.txt][5] 文件。它添加特定于 todo.txt 格式的键绑定。你可以使用 **\x** 标记“已完成”的内容,使用 **\d** 将其设置为当前日期,然后使用 **\a**、**\b** 和 **\c** 更改优先级。你可以提升(**\k**)或降低(**\j**)优先级,并根据项目(**\s+**)、上下文(**\s@**)或日期(**\sd**)排序(**\s**)。完成后,你可以和平常一样关闭和保存文件。 +todo.txt-vim 自动识别以 `todo.txt` 和 `done.txt` 结尾的文件作为 [todo.txt][5] 文件。它添加特定于 todo.txt 格式的键绑定。你可以使用 `\x` 标记“已完成”的内容,使用 `\d` 将其设置为当前日期,然后使用 `\a`、`\b` 和 `\c` 更改优先级。你可以提升(`\k`)或降低(`\j`)优先级,并根据项目(`\s+`)、上下文(`\s@`)或日期(`\sd`)排序(`\s`)。完成后,你可以和平常一样关闭和保存文件。 todo.txt-vim 包是我几天前写的 [todo.sh 程序][6]的一个很好的补充,使用 [todo edit][7] 加载项,它可以增强的你待办事项列表跟踪。 @@ -40,13 +41,12 @@ todo.txt-vim 包是我几天前写的 [todo.sh 程序][6]的一个很好的补 Vim 还有一个不错的用于 [Reddit][9] 的加载项,叫 [vim-reddit][10]。它不如 [Tuir][11] 好,但是用于快速查看最新的文章,它还是不错的。首先安装捆绑包: - ``` -git clone ~/.vim/bundle/vim-reddit +git clone https://github.com/DougBeney/vim-reddit.git ~/.vim/bundle/vim-reddit vim ``` -现在输入 **:Reddit** 将加载 Reddit 首页。你可以使用 **:Reddit name** 加载特定子板。打开文章列表后,使用箭头键导航或使用鼠标滚动。按 **o** 将在 Vim 中打开文章(除非它多媒体文章,它会打开浏览器),然后按 **c** 打开评论。如果要直接转到页面,请按 **O** 而不是 **o**。只需按 **u** 就能返回。当你 Reddit 看完后,输入 **:bd** 就行。vim-reddit 唯一的缺点是无法登录或发布新文章和评论。话又说回来,有时这是一件好事。 +现在输入 `:Reddit` 将加载 Reddit 首页。你可以使用 `:Reddit name` 加载特定子板。打开文章列表后,使用箭头键导航或使用鼠标滚动。按 `o` 将在 Vim 中打开文章(除非它多媒体文章,它会打开浏览器),然后按 `c` 打开评论。如果要直接转到页面,请按 `O` 而不是 `o`。只需按 `u` 就能返回。当你 Reddit 看完后,输入 `:bd` 就行。vim-reddit 唯一的缺点是无法登录或发布新文章和评论。话又说回来,有时这是一件好事。 #### 使用 twitvim 在 Vim 中发推 @@ -54,17 +54,15 @@ vim 最后,我们有 [twitvim][13],这是一个于阅读和发布 Twitter 的 Vim 软件包。它需要更多设置。首先从 GitHub 安装 twitvim: - ``` -`git clone https://github.com/twitvim/twitvim.git ~/.vim/bundle/twitvim` +git clone https://github.com/twitvim/twitvim.git ~/.vim/bundle/twitvim ``` -现在你需要编辑 **.vimrc** 文件并设置一些选项。它帮助插件知道使用哪些库与 Twitter 交互。运行 **vim --version** 并查看哪些语言的前面有 **+** 就代表你的 Vim 支持它。 +现在你需要编辑 `.vimrc` 文件并设置一些选项。它帮助插件知道使用哪些库与 Twitter 交互。运行 `vim --version` 并查看哪些语言的前面有 `+` 就代表你的 Vim 支持它。 ![Enabled and Disabled things in vim][14] -因为我的是 **+perl -python +python3**,所以我知道我可以启用 Perl 和 Python 3 但不是 Python 2 (python)。 - +因为我的是 `+perl -python +python3`,所以我知道我可以启用 Perl 和 Python 3 但不是 Python 2 (python)。 ``` " TwitVim Settings @@ -73,9 +71,9 @@ let twitvim_enable_perl = 1 let twitvim_enable_python3 = 1 ``` -现在,你可以通过运行 **:SetLoginTwitter** 启动浏览器窗口,它会打开一个浏览器窗口要求你授权 VimTwit 访问你的帐户。在 Vim 中输入提供的 PIN 后就可以了。 +现在,你可以通过运行 `:SetLoginTwitter` 启动浏览器窗口,它会打开一个浏览器窗口要求你授权 VimTwit 访问你的帐户。在 Vim 中输入提供的 PIN 后就可以了。 -Twitvim 的命令不像其他包中一样简单。要加载好友和关注者的时间线,请输入 **:FriendsTwitter**。要列出提及你的和回复,请使用 **:MentionsTwitter**。发布新推文是 **:PosttoTwitter <Your message>**。你可以滚动列表并输入 **\r** 回复特定推文,你可以用 **\d** 直接给某人发消息。 +Twitvim 的命令不像其他包中一样简单。要加载好友和关注者的时间线,请输入 `:FriendsTwitter`。要列出提及你的和回复,请使用 `:MentionsTwitter`。发布新推文是 `:PosttoTwitter `。你可以滚动列表并输入 `\r` 回复特定推文,你可以用 `\d` 直接给某人发消息。 就是这些了。你现在可以在 Vim 中做(几乎)所有事了! @@ -86,14 +84,14 @@ via: https://opensource.com/article/20/1/vim-task-list-reddit-twitter 作者:[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/) 荣誉推出 [a]: https://opensource.com/users/ksonney [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) -[2]: https://opensource.com/article/20/1/send-email-and-check-your-calendar-vim +[2]: https://linux.cn/article-11908-1.html [3]: https://opensource.com/sites/default/files/uploads/productivity_17-1.png (to-dos and Twitter with Vim) [4]: https://github.com/freitass/todo.txt-vim [5]: http://todotxt.org From 23d5f755591124b06f12411f494f9615a4118d13 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 21 Feb 2020 11:29:56 +0800 Subject: [PATCH 025/260] PUB @geekpi https://linux.cn/article-11912-1.html --- ... to manage your task list and access Reddit and Twitter.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200127 Use Vim to manage your task list and access Reddit and Twitter.md (98%) diff --git a/translated/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md b/published/20200127 Use Vim to manage your task list and access Reddit and Twitter.md similarity index 98% rename from translated/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md rename to published/20200127 Use Vim to manage your task list and access Reddit and Twitter.md index c7c9be76c6..dcf7ef9dd8 100644 --- a/translated/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md +++ b/published/20200127 Use Vim to manage your task list and access Reddit and Twitter.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11912-1.html) [#]: subject: (Use Vim to manage your task list and access Reddit and Twitter) [#]: via: (https://opensource.com/article/20/1/vim-task-list-reddit-twitter) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From 30d61701de45839f73b83cddc26039ffb47399ea Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 21 Feb 2020 12:08:47 +0800 Subject: [PATCH 026/260] PRF @wxy --- ... the many variations and how to use them.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20190116 Zipping files on Linux- the many variations and how to use them.md b/translated/tech/20190116 Zipping files on Linux- the many variations and how to use them.md index 81731f464c..3580cfb925 100644 --- a/translated/tech/20190116 Zipping files on Linux- the many variations and how to use them.md +++ b/translated/tech/20190116 Zipping files on Linux- the many variations and how to use them.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Zipping files on Linux: the many variations and how to use them) @@ -12,13 +12,13 @@ > 除了压缩和解压缩文件外,你还可以使用 zip 命令执行许多有趣的操作。这是一些其他的 zip 选项以及它们如何提供帮助。 -![](https://images.idgesg.net/images/article/2019/01/zipper-100785364-large.jpg) +![](https://img.linux.net.cn/data/attachment/album/202002/21/120507ox11ak23f9x2hxaq.jpg) 为了节省一些磁盘空间并将文件打包在一起进行归档,我们中的一些人已经在 Unix 和 Linux 系统上压缩文件数十年了。即使这样,并不是所有人都尝试过一些有趣的压缩工具的变体。因此,在本文中,我们将介绍标准的压缩和解压缩以及其他一些有趣的压缩选项。 ### 基本的 zip 命令 -首先,让我们看一下基本的 `zip` 命令。它使用了与 `gzip` 基本上相同的压缩算法,但是有一些重要的区别。一方面,`gzip` 命令仅用于压缩单个文件,而 `zip` 既可以压缩文件,也可以将多个文件结合在一起成为归档文件。另外,`gzip` 命令是“就地”压缩。换句话说,它会留下一个压缩文件,而不是原始文件。 这是工作中的 `gzip` 示例: +首先,让我们看一下基本的 `zip` 命令。它使用了与 `gzip` 基本上相同的压缩算法,但是有一些重要的区别。一方面,`gzip` 命令仅用于压缩单个文件,而 `zip` 既可以压缩文件,也可以将多个文件结合在一起成为归档文件。另外,`gzip` 命令是“就地”压缩。换句话说,它会只留下一个压缩文件,而原始文件则没有了。 这是工作中的 `gzip` 示例: ``` $ gzip onefile @@ -26,7 +26,7 @@ $ ls -l -rw-rw-r-- 1 shs shs 10514 Jan 15 13:13 onefile.gz ``` -而这是 `zip`。请注意,此命令要求为压缩存档提供名称,其中 `gzip`(执行压缩操作后)仅使用原始文件名并添加 `.gz` 扩展名。 +而下面是 `zip`。请注意,此命令要求为压缩存档提供名称,其中 `gzip`(执行压缩操作后)仅使用原始文件名并添加 `.gz` 扩展名。 ``` $ zip twofiles.zip file* @@ -61,7 +61,7 @@ $ zip mybin.zip ~/bin/* ### unzip 命令 -`unzip` 命令将从一个 zip 文件中恢复内容,并且,如你所料,原来的 zip 文件还保留在那里,而类似的`gunzip` 命令将仅保留未压缩的文件。 +`unzip` 命令将从一个 zip 文件中恢复内容,并且,如你所料,原来的 zip 文件还保留在那里,而类似的 `gunzip` 命令将仅保留未压缩的文件。 ``` $ unzip twofiles.zip @@ -272,13 +272,13 @@ $ zipnote twofiles.zip @ (zip file comment below this line) ``` -如果要添加注释,请先将 `zipnote` 命令的输出写入文件: +如果要添加注释,请先将 `zipnote` 命令的输出写入到文件: ``` $ zipnote twofiles.zip > comments ``` -接下来,编辑你刚刚创建的文件,将注释插入到 `(comment above this line)` 行上方。然后使用像这样的`zipnote` 命令添加注释: +接下来,编辑你刚刚创建的文件,将注释插入到 `(comment above this line)` 行上方。然后使用像这样的 `zipnote` 命令添加注释: ``` $ zipnote -w twofiles.zip < comments @@ -286,7 +286,7 @@ $ zipnote -w twofiles.zip < comments ### zipsplit 命令 -当归档文件太大时,可以使用 `zipsplit` 命令将一个 zip 归档文件分解为多个 zip 归档文件,这样你就可以将其中某一个文件放到小型 U 盘中。最简单的方法似乎是为每个部分的压缩文件指定最大大小,此大小必须足够大以容纳最大的包含文件。 +当归档文件太大时,可以使用 `zipsplit` 命令将一个 zip 归档文件分解为多个 zip 归档文件,这样你就可以将其中某一个文件放到小型 U 盘中。最简单的方法似乎是为每个部分的压缩文件指定最大大小,此大小必须足够大以容纳最大的所包含的文件。 ``` $ zipsplit -n 12000 twofiles.zip @@ -312,7 +312,7 @@ via: https://www.networkworld.com/article/3333640/linux/zipping-files-on-linux-t 作者:[Sandra Henry-Stocker][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 7a93253bf582026e0c6aa0d26e0f7e81c3c6bfbb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 21 Feb 2020 12:09:16 +0800 Subject: [PATCH 027/260] PUB @wxy https://linux.cn/article-11913-1.html --- ...files on Linux- the many variations and how to use them.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190116 Zipping files on Linux- the many variations and how to use them.md (99%) diff --git a/translated/tech/20190116 Zipping files on Linux- the many variations and how to use them.md b/published/20190116 Zipping files on Linux- the many variations and how to use them.md similarity index 99% rename from translated/tech/20190116 Zipping files on Linux- the many variations and how to use them.md rename to published/20190116 Zipping files on Linux- the many variations and how to use them.md index 3580cfb925..fbd32f20ca 100644 --- a/translated/tech/20190116 Zipping files on Linux- the many variations and how to use them.md +++ b/published/20190116 Zipping files on Linux- the many variations and how to use them.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11913-1.html) [#]: 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/) From 0165dbf4ccb5889060275c0fb43c8bfc82bb438e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 21 Feb 2020 13:29:19 +0800 Subject: [PATCH 028/260] PRF @geekpi --- ...FuryBSD- A New Desktop BSD Distribution.md | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md b/translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md index f2ea410bf7..e3ab1c35cf 100644 --- a/translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md +++ b/translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Meet FuryBSD: A New Desktop BSD Distribution) @@ -10,23 +10,23 @@ 认识 FuryBSD:一个新的桌面 BSD 发行版 ====== -在过去的几个月中,出现了一些新的桌面 BSD。之前有 [HyperbolaBSD,它是 Hyperbola GNU/Linux][1]。[BSD][2] 世界中的另一个新入者是 [FuryBSD][3]。 +在过去的几个月中,出现了一些新的桌面 BSD。之前有 [HyperbolaBSD,它之前是 Hyperbola GNU/Linux][1]。[BSD][2] 世界中的另一个新入者是 [FuryBSD][3]。 -### FuryBSD:一个新的BSD发行版 +### FuryBSD:一个新的 BSD 发行版 ![][4] -从本质上讲,FuryBSD 是一个非常简单的发行版。根据[它的网站][5]:“FuryBSD 一个是基于 FreeBSD 的轻量级桌面发行版。” 它基本上是预配置了桌面环境,并预安装了多个应用的 FreeBSD。目标是在快速地你的计算机上运行基于 FreeBSD 的系统。 +从本质上讲,FuryBSD 是一个非常简单的小东西。根据[它的网站][5]:“FuryBSD 一个是基于 FreeBSD 的轻量级桌面发行版。” 它基本上是预配置了桌面环境,并预安装了多个应用的 FreeBSD。目地是快速地在你的计算机上运行基于 FreeBSD 的系统。 你可能会认为这听起来很像其他几个已有的 BSD,例如 [NomadBSD][6] 和 [GhostBSD][7]。这些 BSD 与 FuryBSD 之间的主要区别在于 FuryBSD 与现有的 FreeBSD 更加接近。例如,FuryBSD 使用 FreeBSD 安装程序,而其他发行版则用了自己的安装程序和工具。 -正如[[它的网站][8]所说:“尽管 FuryBSD 可能类似于 PC-BSD 和 TrueOS 等图形化 BSD 项目,但 FuryBSD 是由不同的团队创建的,并且采用了与 FreeBSD 紧密集成的不同方法。这样可以降低开销,并保持与上游的兼容性。”开发领导还告诉我:“FuryBSD 的一个主要重点是使其成为一种小型 Live 媒体,并带有一些辅助工具来测试硬件驱动程序。” +正如[它的网站][8]所说:“尽管 FuryBSD 可能类似于 PC-BSD 和 TrueOS 等图形化 BSD 项目,但 FuryBSD 是由不同的团队创建的,并且采用了不同与 FreeBSD 着重于紧密集成的方法。这样可以降低开销,并保持与上游的兼容性。”开发负责人还告诉我:“FuryBSD 的一个主要重点是使其成为一种小型现场版介质,并带有一些测试硬件驱动程序的辅助工具。” -当前,你可以进入 [FuryBSD 主页][3]并下载 XFCE 或 KDE LiveCD。GNOME 版本正在开发中。 +当前,你可以进入 [FuryBSD 主页][3]并下载 XFCE 或 KDE 的 LiveCD。GNOME 版本正在开发中。 ### FuryBSD 的背后是谁 -FuryBSD 的主要开发者是 [Joe Maloney][9]。Joe 多年来一直是 FreeBSD 的用户。他为 PC-BSD 等其他 BSD 项目做出了贡献。他还与 GhostBSD 的创建者 Eric Turgeon 一起重写了 GhostBSD LiveCD。在此过程中,他对 BSD 有了更好的了解,并开始形成自己如何进行发行的想法。 +FuryBSD 的主要开发者是 [Joe Maloney][9]。Joe 多年来一直是 FreeBSD 的用户。他为 PC-BSD 等其他 BSD 项目做过贡献。他还与 GhostBSD 的创建者 Eric Turgeon 一起重写了 GhostBSD LiveCD。在此过程中,他对 BSD 有了更好的了解,并开始形成自己如何做一个发行版的想法。 Joe 与其他参与 BSD 世界多年的开发者一起加入了开发,例如 Jaron Parsons、Josh Smith 和 Damian Szidiropulosz。 @@ -34,7 +34,7 @@ Joe 与其他参与 BSD 世界多年的开发者一起加入了开发,例如 J 目前,FuryBSD 仅仅是预配置的 FreeBSD。但是,开发者有一份[要改进的清单][5]。包括: -* 可靠的加载框架、第三方专有图形驱动、无线 +* 可靠的加载框架、第三方专有图形驱动、无线网络 * 进一步整理 LiveCD 体验,以使其更加友好 * 开箱即用的打印支持 * 包含更多默认应用,以提供完整的桌面体验 @@ -47,9 +47,7 @@ Joe 与其他参与 BSD 世界多年的开发者一起加入了开发,例如 J * 目录服务集成 * 安全加固 - - -开发者非常清楚地表明,他们所做的任何更改都需要大量的思考和研究。他们不会赞美某个功能,只会在它破坏一些东西时删除或者修改它。 +开发者非常清楚地表明,他们所做的任何更改都需要大量的思考和研究。他们不会改进某个功能,只会在它破坏一些东西时删除或者修改它。 ![FuryBSD desktop][11] @@ -72,7 +70,7 @@ via: https://itsfoss.com/furybsd/ 作者:[John Paul][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/) 荣誉推出 @@ -91,4 +89,4 @@ via: https://itsfoss.com/furybsd/ [11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/FuryBSDS-desktop.jpg?resize=800%2C450&ssl=1 [12]: https://forums.furybsd.org/ [13]: https://github.com/furybsd -[14]: https://reddit.com/r/linuxusersgroup \ No newline at end of file +[14]: https://reddit.com/r/linuxusersgroup From 7ca0296ce0b8f448e273e5fffae32999e7d9aa62 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 21 Feb 2020 13:30:54 +0800 Subject: [PATCH 029/260] PUB @geekpi https://linux.cn/article-11915-1.html --- .../20200130 Meet FuryBSD- A New Desktop BSD Distribution.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md (98%) diff --git a/translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md b/published/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md similarity index 98% rename from translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md rename to published/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md index e3ab1c35cf..611ed7c315 100644 --- a/translated/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md +++ b/published/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11915-1.html) [#]: subject: (Meet FuryBSD: A New Desktop BSD Distribution) [#]: via: (https://itsfoss.com/furybsd/) [#]: author: (John Paul https://itsfoss.com/author/john/) From c01758e1f0a65b9d2dd44b9d1b1235644b0aca3c Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Fri, 21 Feb 2020 20:31:39 +0800 Subject: [PATCH 030/260] translated --- ...came the Standard for Compute Resources.md | 49 ------------------ ...came the Standard for Compute Resources.md | 50 +++++++++++++++++++ 2 files changed, 50 insertions(+), 49 deletions(-) delete mode 100644 sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md create mode 100644 translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md diff --git a/sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md b/sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md deleted file mode 100644 index 2ae6e33edd..0000000000 --- a/sources/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md +++ /dev/null @@ -1,49 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (heguangzhi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How Kubernetes Became the Standard for Compute Resources) -[#]: via: (https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compute-resources/) -[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) - -How Kubernetes Became the Standard for Compute Resources -====== - - - -2019 has been a game-changing year for the cloud-native ecosystem. There were [consolidations][1], acquisitions of powerhouses like Red Hat Docker and Pivotal, and the emergence of players like Rancher Labs and Mirantis. - -“All these consolidation and M&A in this space is an indicator of how fast the market has matured,” said Sheng Liang, co-founder and CEO of Rancher Labs, a company that offers a complete software stack for teams adopting containers. - -Traditionally, emerging technologies like Kubernetes and Docker appeal to tinkerers and mega-scalers such as Facebook and Google. There was very little interest outside of that group. However, both of these technologies experienced massive adoption at the enterprise level. Suddenly, there was a massive market with huge opportunities. Almost everyone jumped in. There were players who were bringing innovative solutions and then there were players who were trying to catch up with the rest. It became very crowded very quickly. - -It also changed the way innovation was happening. [Early adopters were usually tech-savvy companies.][2] Now, almost everyone is using it, even in areas that were not considered turf for Kubernetes. It changed the market dynamics as companies like Rancher Labs were witnessing unique use cases. - -Liang adds, “I’ve never been in a market or technology evolution that’s happened as quickly and as dynamically as Kubernetes. When we started some five years ago, it was a very crowded space. Over time, most of our peers disappeared for one reason or the other. Either they weren’t able to adjust to the change or they chose not to adjust to some of the changes.” - -In the early days of Kubernetes, the most obvious opportunity was to build Kubernetes distro and Kubernetes operations. It’s new technology. It’s known to be reasonably complex to install, upgrade, and operate. - -It all changed when Google, AWS, and Microsoft entered the market. At that point, there was a stampede of vendors rushing in to provide solutions for the platform. “As soon as cloud providers like Google decided to make Kubernetes as a service and offered it for free as loss-leader to drive infrastructure consumption, we knew that the business of actually operating and supporting Kubernetes, the upside of that would be very limited,” said Liang. - -Not everything was bad for non-Google players. Since cloud vendors removed all the complexity that came with Kubernetes by offering it as a service, it meant wider adoption of the technology, even by those who refrained from using it due to the overhead of operating it. It meant that Kubernetes would become ubiquitous and would become an industry standard. - -“Rancher Labs was one of the very few companies that saw this as an opportunity and looked one step further than everyone else. We realized that Kubernetes was going to become the new computing standard, just the way TCP/IP became the networking standard,” said Liang. - -CNCF plays a critical role in building a vibrant ecosystem around Kubernetes, creating a massive community to build, nurture and commercialize cloud-native open source technologies. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compute-resources/ - -作者:[Swapnil Bhartiya][a] -选题:[lujun9972][b] -译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/author/swapnil/ -[b]: https://github.com/lujun9972 -[1]: https://www.cloudfoundry.org/blog/2019-is-the-year-of-consolidation-why-ibms-deal-with-red-hat-is-a-harbinger-of-things-to-come/ -[2]: https://www.packet.com/blog/open-source-season-on-the-kubernetes-highway/ diff --git a/translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md b/translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md new file mode 100644 index 0000000000..901635d6a5 --- /dev/null +++ b/translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md @@ -0,0 +1,50 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Kubernetes Became the Standard for Compute Resources) +[#]: via: (https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compute-resources/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Kubernetes 如何成为计算资源的标准 +====== + + + + +对于原生云生态系统来说,2019年是改变游戏规则的一年。有大的[并购][1),如 Red Hat Docker 和 Pivotal,并出现其他的玩家 如Rancher Labs 和 Mirantis 。 + +“所有这些并购",Rancher Labs (一家为采用容器的团队提供完整软件栈的公司) 的联合创始人兼首席执行官盛亮表示:“这一领域的成功表明市场成熟的速度很快。”。 + +传统上,像 Kubernetes 和 Docker 这样的新兴技术吸引着开发者和像脸书和谷歌这样的超级用户。这群人之外没什么其他的兴趣。然而,这两种技术都在企业层面得到了广泛采用。突然间,有了一个巨大的市场,有了巨大的机会。几乎每个人都跳了进去。有人带来了创新的解决方案,也有人试图赶上其他人。它很快变得非常拥挤和热闹起来。 + +它也改变了创新的方式。[早期采用者通常是精通技术的公司。][2]现在,几乎每个人都在使用它,即使是在不被认为是 Kubernetes 地盘的地方。它改变了市场动态,像 Rancher Labs 这样的公司见证了独特的用例。 + +梁补充道,“我从来没有经历过像 Kubernete 这样快速、动态的市场或这样的技术进化。当我们五年前开始的时候,这是一个非常拥挤的空间。随着时间的推移,我们大多数的同龄人因为这样或那样的原因消失了。他们要么无法适应变化,要么选择不适应某些变化。” + +在 Kubernetes 的早期,最明显的机会是建立 Kubernetes 发行版本和 Kubernetes 业务。这是新技术。众所周知,它的安装、升级和操作相当的复杂。 + +当谷歌、AWS 和微软进入市场时,一切都变了。当时,有一群供应商蜂拥而至,为平台提供解决方案。梁表示:“一旦像谷歌这样的云提供商决定将Kubernetes 作为一项服务,并亏本出售的商品免费提供,以推动基础设施消费;我们就知道,运营和支持 Kubernetes 业务的优势将非常有限了。”。 + +对非谷歌玩家来说,并非一切都不好。由于云供应商通过将它作为服务来提供,消除了 Kubernetes 带来的所有复杂性,这意味着更广泛地采用该技术,即使是那些由于运营成本而不愿使用该技术的人也是如此。这意味着 Kubernetes 将变得无处不在,并将成为一个行业标准。 + +“Rancher Labs 是极少数将此视为机遇并比其他公司看得更远的公司之一。我们意识到 Kubernetes 将成为新的计算标准,就像TCP/IP成为网络标准一样,”梁说。 + +CNCF围绕 Kubernetes 构建一个充满活力的生态系统方面发挥着至关重要的作用,创建了一个庞大的社区来构建、培育和商业化原生云开源技术。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compute-resources/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.cloudfoundry.org/blog/2019-is-the-year-of-consolidation-why-ibms-deal-with-red-hat-is-a-harbinger-of-things-to-come/ +[2]: https://www.packet.com/blog/open-source-season-on-the-kubernetes-highway/ From 83bbcc70c422f266b31e83ceb3d2361615a27c94 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Fri, 21 Feb 2020 20:43:59 +0800 Subject: [PATCH 031/260] Update 20200220 Using Python and GNU Octave to plot data.md --- .../tech/20200220 Using Python and GNU Octave to plot data.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200220 Using Python and GNU Octave to plot data.md b/sources/tech/20200220 Using Python and GNU Octave to plot data.md index 6c59d38eda..5c9bd4facd 100644 --- a/sources/tech/20200220 Using Python and GNU Octave to plot data.md +++ b/sources/tech/20200220 Using Python and GNU Octave to plot data.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (heguangzhi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -656,7 +656,7 @@ via: https://opensource.com/article/20/2/python-gnu-octave-data-science 作者:[Cristiano L. Fontana][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[heguangzhi](https://github.com/heguangzhi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8b69cb9c05ecc91716ebc95c00fccafe3d780523 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 21 Feb 2020 21:59:31 +0800 Subject: [PATCH 032/260] PRF @geekpi --- ...rd- Why Linux Users Going Crazy Over it.md | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/translated/tech/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md b/translated/tech/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md index c3f781ac47..f9b3bde050 100644 --- a/translated/tech/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md +++ b/translated/tech/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What is WireGuard? Why Linux Users Going Crazy Over it?) [#]: via: (https://itsfoss.com/wireguard/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -什么是 WireGuard?为什么 Linux 用户对它疯狂? +什么是 WireGuard?为什么 Linux 用户为它疯狂? ====== 从普通的 Linux 用户到 Linux 创建者 [Linus Torvalds][1],每个人都对 WireGuard 很感兴趣。什么是 WireGuard,它为何如此特别? @@ -18,7 +18,6 @@ [WireGuard][3] 是一个易于配置、快速且安全的开源 [VPN][4],它利用了最新的加密技术。目的是提供一种更快、更简单、更精简的通用 VPN,它可以轻松地在树莓派这类低端设备到高端服务器上部署。 - [IPsec][5] 和 OpenVPN 等大多数其他解决方案是几十年前开发的。安全研究人员和内核开发人员 Jason Donenfeld 意识到它们速度慢且难以正确配置和管理。 这让他创建了一个新的开源 VPN 协议和解决方案,它更加快速、安全、易于部署和管理。 @@ -31,31 +30,31 @@ WireGuard 最初是为 Linux 开发的,但现在可用于 Windows、macOS、BS 除了可以跨平台之外,WireGuard 的最大优点之一就是易于部署。配置和部署 WireGuard 就像配置和使用 SSH 一样容易。 -看看 [WireGuard 设置指南][7]。安装 WireGuard、生成公钥和私钥(像 SSH 一样),设置防火墙规则并启动服务。现在将它和 [OpenVPN 设置指南][8]进行比较。它有太多要做的了。 +看看 [WireGuard 设置指南][7]。安装 WireGuard、生成公钥和私钥(像 SSH 一样),设置防火墙规则并启动服务。现在将它和 [OpenVPN 设置指南][8]进行比较——有太多要做的了。 -WireGuard 的另一个好处是它有一个仅 4000 行代码的精简代码库。将它与 [OpenVPN][9](另一个流行的开源 VPN)的 100,000 行代码相比。显然,调试W ireGuard 更加容易。 +WireGuard 的另一个好处是它有一个仅 4000 行代码的精简代码库。将它与 [OpenVPN][9](另一个流行的开源 VPN)的 100,000 行代码相比。显然,调试 WireGuard 更加容易。 -不要小看它的简单。WireGuard 支持所有最新的加密技术,例如 [Noise协议框架][10]、[Curve25519][11]、[ChaCha20][12]、[Poly1305][13]、[BLAKE2][14]、[SipHash24][15]、[HKDF][16] 和安全受信任结构。 +不要因其简单而小看它。WireGuard 支持所有最新的加密技术,例如 [Noise 协议框架][10]、[Curve25519][11]、[ChaCha20][12]、[Poly1305][13]、[BLAKE2][14]、[SipHash24][15]、[HKDF][16] 和安全受信任结构。 由于 WireGuard 运行在[内核空间][17],因此可以高速提供安全的网络。 这些是 WireGuard 越来越受欢迎的一些原因。Linux 创造者 Linus Torvalds 非常喜欢 WireGuard,以至于将其合并到 [Linux Kernel 5.6][18] 中: -> 我能否再次声明对它的爱,并希望它能很快合并?也许代码不是完美的,但我已经忽略,与 OpenVPN 和 IPSec 的恐怖相比,这是一件艺术品。 +> 我能否再次声明对它的爱,并希望它能很快合并?也许代码不是完美的,但我不在乎,与 OpenVPN 和 IPSec 的恐怖相比,这是一件艺术品。 > > Linus Torvalds ### 如果 WireGuard 已经可用,那么将其包含在 Linux 内核中有什么大惊小怪的? -这可能会让新的 Linux 用户感到困惑。你知道可以在 Linux 上安装和配置 WireGuard VPN 服务器,但同时会看到 Linux Kernel 5.6 将包含 WireGuard 的消息。让我向您解释。 +这可能会让新的 Linux 用户感到困惑。你知道可以在 Linux 上安装和配置 WireGuard VPN 服务器,但同时也会看到 Linux Kernel 5.6 将包含 WireGuard 的消息。让我向您解释。 -目前,你可以将 WireGuard 作为[内核模块][19]安装在 Linux 中。诸如 VLC、GIMP 等常规应用安装在 Linux 内核之上(在 [用户空间][20]中),而不是内部。 +目前,你可以将 WireGuard 作为[内核模块][19]安装在 Linux 中。而诸如 VLC、GIMP 等常规应用安装在 Linux 内核之上(在 [用户空间][20]中),而不是内部。 -当将 WireGuard 安装为内核模块时,基本上是自行修改 Linux 内核并向其添加代码。从 5.6 内核开始,你无需手动添加内核模块。默认情况下它将包含在内核中。 +当将 WireGuard 安装为内核模块时,基本上需要你自行修改 Linux 内核并向其添加代码。从 5.6 内核开始,你无需手动添加内核模块。默认情况下它将包含在内核中。 在 5.6 内核中包含 WireGuard 很有可能[扩展 WireGuard 的采用,从而改变当前的 VPN 场景][21]。 -**总结** +### 总结 WireGuard 之所以受欢迎是有充分理由的。诸如 [Mullvad VPN][23] 之类的一些流行的[关注隐私的 VPN][22] 已经在使用 WireGuard,并且在不久的将来,采用率可能还会增长。 @@ -68,7 +67,7 @@ via: https://itsfoss.com/wireguard/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -96,4 +95,4 @@ via: https://itsfoss.com/wireguard/ [20]: http://www.linfo.org/user_space.html [21]: https://www.zdnet.com/article/vpns-will-change-forever-with-the-arrival-of-wireguard-into-linux/ [22]: https://itsfoss.com/best-vpn-linux/ -[23]: https://mullvad.net/en/ \ No newline at end of file +[23]: https://mullvad.net/en/ From 98721cdbd793d6f306ac77ebcf9f356d3eedcf72 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 21 Feb 2020 22:00:09 +0800 Subject: [PATCH 033/260] PUB @geekpi https://linux.cn/article-11916-1.html --- ... What is WireGuard- Why Linux Users Going Crazy Over it.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md (98%) diff --git a/translated/tech/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md b/published/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md similarity index 98% rename from translated/tech/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md rename to published/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md index f9b3bde050..56b1584ee1 100644 --- a/translated/tech/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md +++ b/published/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11916-1.html) [#]: subject: (What is WireGuard? Why Linux Users Going Crazy Over it?) [#]: via: (https://itsfoss.com/wireguard/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 9cdf01ba5086607010e9f498b70dab43890ab5d8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 22 Feb 2020 10:29:09 +0800 Subject: [PATCH 034/260] PRF @geekpi --- ... Modern Looking Open Source XMPP Client.md | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/translated/tech/20200211 Dino is a Modern Looking Open Source XMPP Client.md b/translated/tech/20200211 Dino is a Modern Looking Open Source XMPP Client.md index 3985d1a415..31c35e0211 100644 --- a/translated/tech/20200211 Dino is a Modern Looking Open Source XMPP Client.md +++ b/translated/tech/20200211 Dino is a Modern Looking Open Source XMPP Client.md @@ -1,32 +1,34 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Dino is a Modern Looking Open Source XMPP Client) [#]: via: (https://itsfoss.com/dino-xmpp-client/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Dino 是一个有着现代外观的开源 XMPP 客户端 +Dino:一个有着现代外观的开源 XMPP 客户端 ====== -_**简介:Dino 是一个相对较新的开源 XMPP 客户端,它尝试提供良好的用户体验,同时鼓励注重隐私的用户使用 XMPP 发送消息。**_ +> Dino 是一个相对较新的开源 XMPP 客户端,它试图提供良好的用户体验,鼓励注重隐私的用户使用 XMPP 发送消息。 + +![](https://img.linux.net.cn/data/attachment/album/202002/22/102844mhzgzb3533xgq6d8.jpg) ### Dino:一个开源 XMPP 客户端 ![][1] -[XMPP][2] (可扩展通讯和表示协议) 是一个去中心化的网络模型,可促进即时消息传递和协作。去中心化意味着没有中央服务器可以访问你的数据。通信直接点对点。 +[XMPP][2](可扩展通讯和表示协议eXtensible Messaging Presence Protocol) 是一个去中心化的网络模型,可促进即时消息传递和协作。去中心化意味着没有中央服务器可以访问你的数据。通信直接点对点。 -我们中的一些人可能会称它为"老派"技术,可能是因为 XMPP 客户端通常有着非常糟糕的用户体验,或者仅仅是因为它需要时间来适应(或设置它)。 +我们中的一些人可能会称它为“老派”技术,可能是因为 XMPP 客户端通常用户体验非常糟糕,或者仅仅是因为它需要时间来适应(或设置它)。 -这时候 [Dino[3] 作为现代 XMPP 客户端出现了,在不损害你的隐私的情况下提供干净清爽的用户体验。 +这时候 [Dino][3] 作为现代 XMPP 客户端出现了,在不损害你的隐私的情况下提供干净清爽的用户体验。 ### 用户体验 ![][4] -Dino 有试图改善 XMPP 客户端的用户体验,但值得注意的是,它的外观和感受将在一定程度上取决于你的 Linux 发行版。你的图标主题或 Gnome 主题会让你的个人体验更好或更糟。 +Dino 试图改善 XMPP 客户端的用户体验,但值得注意的是,它的外观和感受将在一定程度上取决于你的 Linux 发行版。你的图标主题或 Gnome 主题会让你的个人体验更好或更糟。 从技术上讲,它的用户界面非常简单,易于使用。所以,我建议你看下 Ubuntu 中的[最佳图标主题][5]和 [GNOME 主题][6]来调整 Dino 的外观。 @@ -34,7 +36,7 @@ Dino 有试图改善 XMPP 客户端的用户体验,但值得注意的是,它 ![Dino Screenshot][7] -你可以期望将 Dino 用作 Slack、[Signal][8] 或 [Wire][9] 的替代产品,来用于你的业务或个人用途。 +你可以将 Dino 用作 Slack、[Signal][8] 或 [Wire][9] 的替代产品,来用于你的业务或个人用途。 它提供了消息应用所需的所有基本特性,让我们看下你可以从中得到的: @@ -47,14 +49,10 @@ Dino 有试图改善 XMPP 客户端的用户体验,但值得注意的是,它 * 支持 [OpenPGP][10] 和 [OMEMO][11] 加密 * 轻量级原生桌面应用 - - ### 在 Linux 上安装 Dino 你可能会发现它列在你的软件中心中,也可能未找到。Dino 为基于 Debian(deb)和 Fedora(rpm)的发行版提供了可用的二进制文件。 -**对于 Ubuntu:** - Dino 在 Ubuntu 的 universe 仓库中,你可以使用以下命令安装它: ``` @@ -63,15 +61,15 @@ sudo apt install dino-im 类似地,你可以在 [GitHub 分发包页面][12]上找到其他 Linux 发行版的包。 -如果你想要获取最新的,你可以在 [OpenSUSE 的软件页面][13]找到 Dino 的 **.deb** 和 .**rpm** (每日构建版)安装在 Linux 中。 +如果你想要获取最新的,你可以在 [OpenSUSE 的软件页面][13]找到 Dino 的 **.deb** 和 .**rpm** (每日构建版)安装在 Linux 中。 在任何一种情况下,前往它的 [Github 页面][14]或点击下面的链接访问官方网站。 -[下载 Dino][3] +- [下载 Dino][3] -**总结** +### 总结 -它工作良好没有出过任何问题(在我编写这篇文章时快速测试过它)。我将尝试探索更多,并希望能涵盖更多有关 XMPP 的文章来鼓励用户使用 XMPP 的客户端和服务器用于通信。 +在我编写这篇文章时快速测试过它,它工作良好,没有出过问题。我将尝试探索更多,并希望能涵盖更多有关 XMPP 的文章来鼓励用户使用 XMPP 的客户端和服务器用于通信。 你觉得 Dino 怎么样?你会推荐另一个可能好于 Dino 的开源 XMPP 客户端吗?在下面的评论中让我知道你的想法。 @@ -82,7 +80,7 @@ via: https://itsfoss.com/dino-xmpp-client/ 作者:[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/) 荣誉推出 From 26d840f3c576d397266e5b443ac27fed38049cd5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 22 Feb 2020 10:29:42 +0800 Subject: [PATCH 035/260] PUB @geekpi https://linux.cn/article-11917-1.html --- ...200211 Dino is a Modern Looking Open Source XMPP Client.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200211 Dino is a Modern Looking Open Source XMPP Client.md (98%) diff --git a/translated/tech/20200211 Dino is a Modern Looking Open Source XMPP Client.md b/published/20200211 Dino is a Modern Looking Open Source XMPP Client.md similarity index 98% rename from translated/tech/20200211 Dino is a Modern Looking Open Source XMPP Client.md rename to published/20200211 Dino is a Modern Looking Open Source XMPP Client.md index 31c35e0211..82b969948c 100644 --- a/translated/tech/20200211 Dino is a Modern Looking Open Source XMPP Client.md +++ b/published/20200211 Dino is a Modern Looking Open Source XMPP Client.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11917-1.html) [#]: subject: (Dino is a Modern Looking Open Source XMPP Client) [#]: via: (https://itsfoss.com/dino-xmpp-client/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 693470bbfe5a9579bda123f9d6df6a780f9db774 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 22 Feb 2020 18:01:59 +0800 Subject: [PATCH 036/260] translate done: 20170918 Fun and Games in Emacs.md --- .../tech/20170918 Fun and Games in Emacs.md | 234 ----------------- .../tech/20170918 Fun and Games in Emacs.md | 243 ++++++++++++++++++ 2 files changed, 243 insertions(+), 234 deletions(-) delete mode 100644 sources/tech/20170918 Fun and Games in Emacs.md create mode 100644 translated/tech/20170918 Fun and Games in Emacs.md diff --git a/sources/tech/20170918 Fun and Games in Emacs.md b/sources/tech/20170918 Fun and Games in Emacs.md deleted file mode 100644 index 64123ff680..0000000000 --- a/sources/tech/20170918 Fun and Games in Emacs.md +++ /dev/null @@ -1,234 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fun and Games in Emacs) -[#]: via: (https://www.masteringemacs.org/article/fun-games-in-emacs) -[#]: author: (Mickey Petersen https://www.masteringemacs.org/about) - -Fun and Games in Emacs -====== - -It’s yet another Monday and you’re hard at work on those [TPS reports][1] for your boss, Lumbergh. Why not play Emacs’s Zork-like text adventure game to take your mind off the tedium of work? - -But seriously, yes, there are both games and quirky playthings in Emacs. Some you have probably heard of or played before. The only thing they have in common is that most of them were added a long time ago: some are rather odd inclusions (as you’ll see below) and others were clearly written by bored employees or graduate students. What they all have in common is a whimsy and a casualness that I rarely see in Emacs today. Emacs is Serious Business now in a way that it probably wasn’t back in the 1980s when some of these games were written. - -### Tower of Hanoi - -The [Tower of Hanoi][2] is an ancient mathematical puzzle game and one that is probably familiar to some of us as it is often used in Computer Science as a teaching aid because of its recursive and iterative solutions. - -![Tower of Hanoi Screenshot](https://www.masteringemacs.org/static/uploads/hanoi.png) - -In Emacs there are three commands you can run to trigger the Tower of Hanoi puzzle: M-x hanoi with a default of 3 discs; M-x hanoi-unix and M-x hanoi-unix-64 uses the unix timestamp, making a move each second in line with the clock, and with the latter pretending it uses a 64-bit clock. - -The Tower of Hanoi implementation in Emacs dates from the mid 1980s — an awful long time ago indeed. There are a few Customize options (M-x customize-group RET hanoi RET) such as enabling colorized discs. And when you exit the Hanoi buffer or type a character you are treated to a sarcastic goodbye message (see above.) - -### 5x5 - -![5x5 game grid](https://www.masteringemacs.org/static/uploads/5x5.png) - The 5x5 game is a logic puzzle: you are given a 5x5 grid with a central cross already filled-in; your goal is to fill all the cells by toggling them on and off in the right order to win. It’s not as easy as it sounds! - -To play, type M-x 5x5, and with an optional digit argument you can change the size of the grid. What makes this game interesting is its rather complex ability to suggest the next move and attempt to solve the game grid. It uses Emacs’s very own, and very cool, symbolic RPN calculator M-x calc (and in [Fun with Emacs Calc][3] I use it to solve a simple problem.) - -So what I like about this game is that it comes with a very complex solver – really, you should read the source code with M-x find-library RET 5x5 – and a “cracker” that attempts to brute force solutions to the game. - -Try creating a bigger game grid, such as M-10 M-x 5x5, and then run one of the crack commands below. The crackers will attempt to iterate their way to the best solution. This runs in real time and is fun to watch: - - - -`M-x 5x5-crack-mutating-best` - Attempt to crack 5x5 by mutating the best solution. - -`M-x 5x5-crack-mutating-current` - Attempt to crack 5x5 by mutating the current solution. - -`M-x 5x5-crack-randomly` - Attempt to crack 5x5 using random solutions. - -`M-x 5x5-crack-xor-mutate` - Attempt to crack 5x5 by xoring the current and best solution. - -### Text Animation - -You can display a fancy birthday present animation by running M-x animate-birthday-present and giving it your name. It looks rather cool! - -![xkcd](https://imgs.xkcd.com/comics/real_programmers.png) - -The animate package is also used by M-x butterfly command, a command added to Emacs as an homage to the [XKCD][4] strip above. Of course the Emacs command in the strip is teeechnically not valid but the humor more than makes up for it. - -### Blackbox - -The objective of this game I am going to quote literally: - -> The object of the game is to find four hidden balls by shooting rays into the black box. There are four possibilities: 1) the ray will pass thru the box undisturbed, 2) it will hit a ball and be absorbed, 3) it will be deflected and exit the box, or 4) be deflected immediately, not even being allowed entry into the box. - -So, it’s a bit like the [Battleship][5] most of us played as kids but… for people with advanced degrees in physics? - -It’s another game that was added back in the 1980s. I suggest you read the extensive documentation on how to play by typing C-h f blackbox. - -### Bubbles - -![Bubbles game](https://www.masteringemacs.org/static/uploads/bubbles.png) - -The M-x bubbles game is rather simple: you must clear out as many “bubbles” as you can in as few moves as possible. When you remove bubbles the other bubbles drop and stick together. It’s a fun game that, as an added bonus, comes with graphics if you use Emacs’s GUI. It also works with your mouse. - -You can configure the difficulty of the game by calling M-x bubbles-set-game- where is one of: easy, medium, difficult, hard, or userdefined. Furthermore, you can alter the graphics, grid size and colors using Customize: M-x customize-group bubbles. - -For its simplicity and fun factor, this ranks as one of my favorite games in Emacs. - -### Fortune & Cookie - -I like the fortune command. Snarky, unhelpful and often sarcastic “advice” mixed in with literature and riddles brightens up my day whenever I launch a new shell. - -Rather confusingly there are two packages in Emacs that does more-or-less the same thing: fortune and cookie1. The former is geared towards putting fortune cookie messages in email signatures and the latter is just a simple reader for the fortune format. - -Anyway, to use Emacs’s cookie1 package you must first tell it where to find the file by customizing the variable cookie-file with customize-option RET cookie RET. - -If you’re on Ubuntu you will have to install the fortune package first. The files are found in the /usr/share/games/fortunes/ directory. - -You can then call M-x cookie or, should you want to do this, find all matching cookies with M-x cookie-apropos. - -### Decipher - -This package perfectly captures the utilitarian nature of Emacs: it’s a package to help you break simple substitution ciphers (like cryptogram puzzles) using a helpful user interface. You just know that – more than twenty years ago – someone really had a dire need to break a lot of basic ciphers. It’s little things like this module that makes me overjoyed to use Emacs: a module of scant importance to all but a few people and, yet, should you need it – there it is. - -So how do you use it then? Well, let’s consider the “rot13” cipher: rotating characters by 13 places in a 26-character alphabet. It’s an easy thing to try out in Emacs with M-x ielm, Emacs’s REPL for [Evaluating Elisp][6]: - -``` -*** Welcome to IELM *** Type (describe-mode) for help. -ELISP> (rot13 "Hello, World") -"Uryyb, Jbeyq" -ELISP> (rot13 "Uryyb, Jbeyq") -"Hello, World" -ELISP> -``` - -So how can the decipher module help us here? Well, create a new buffer test-cipher and type in your cipher text (in my case Uryyb, Jbeyq) - -![cipher](https://www.masteringemacs.org/static/uploads/cipher.png) - -You’re now presented with a rather complex interface. You can now place the point on any of the characters in the ciphertext on the purple line and guess what the character might be: Emacs will update the rest of the plaintext guess with your choices and tell you how the characters in the alphabet have been allocated thus far. - -You can then start winnowing down the options using various helper commands to help infer which cipher characters might correspond to which plaintext character: - - - -`D` - Shows a list of digrams (two-character combinations from the cipher) and their frequency - -`F` - Shows the frequency of each ciphertext letter - -`N` - Shows adjacency of characters. I am not entirely sure how this works. - -`M` and `R` - Save and restore a checkpoint, allowing you to branch your work and explore different ways of cracking the cipher. - -All in all, for such an esoteric task, this package is rather impressive! If you regularly solve cryptograms maybe this package can help? - -### Doctor - -![doctor](https://www.masteringemacs.org/static/uploads/doctor.png) - -Ah, the Emacs doctor. Based on the original [ELIZA][7] the “Doctor” tries to psychoanalyze what you say and attempts to repeat the question back to you. Rather fun, for a few minutes, and one of the more famous Emacs oddities. You can run it with M-x doctor. - -### Dunnet - -Emacs’s very own Zork-like text adventure game. To play it, type M-x dunnet. It’s rather good, if short, but it’s another rather famous Emacs game that too few have actually played through to the end. - -If you find yourself with time to kill between your TPS reports then it’s a great game with a built-in “boss screen” as it’s text-only. - -Oh, and, don’t try to eat the CPU card :) - -### Gomoku - -![gomoku](https://www.masteringemacs.org/static/uploads/gomoku.png) - -Another game written in the 1980s. You have to connect 5 squares, tic-tac-toe style. You can play against Emacs with M-x gomoku. The game also supports the mouse, which is rather handy. You can customize the group gomoku to adjust the size of the grid. - -### Game of Life - -[Conway’s Game of Life][8] is a famous example of cellular automata. The Emacs version comes with a handful of starting patterns that you can (programmatically with elisp) alter by adjusting the life-patterns variable. - -You can trigger a game of life with M-x life. The fact that the whole thing, display code, comments and all, come in at less than 300 characters is also rather impressive. - -### Pong, Snake and Tetris - -![tetris](https://www.masteringemacs.org/static/uploads/tetris.png) - -These classic games are all implemented using the Emacs package gamegrid, a generic framework for building grid-based games like Tetris and Snake. The great thing about the gamegrid package is its compatibility with both graphical and terminal Emacs: if you run Emacs in a GUI you get fancy graphics; if you don’t, you get simple ASCII art. - -You can run the games by typing M-x pong, M-x snake, or M-x tetris. - -The Tetris game in particular is rather faithfully implemented, having both gradual speed increase and the ability to slide blocks into place. And given you have the code to it, you can finally remove that annoying Z-shaped piece no one likes! - -### Solitaire - -![solitaire image](https://www.masteringemacs.org/static/uploads/solitaire.png) - -This is not the card game, unfortunately. But a peg-based game where you have to end up with just one stone on the board, by taking a stone (the o) and “jumping” over an adjacent stone into the hole (the .), removing the stone you jumped over in the process. Rinse and repeat until the board is empty. - -There is a handy solver built in called M-x solitaire-solve if you get stuck. - -### Zone - -Another of my favorites. This time’s it’s a screensaver – or rather, a series of screensavers. - -Type M-x zone and watch what happens to your screen! - -You can configure a screensaver idle time by running M-x zone-when-idle (or calling it from elisp) with an idle time in seconds. You can turn it off with M-x zone-leave-me-alone. - -This one’s guaranteed to make your coworkers freak out if it kicks off while they are looking. - -### Multiplication Puzzle - -![mpuz](https://www.masteringemacs.org/static/uploads/mpuz.png) - -This is another brain-twisting puzzle game. When you run M-x mpuz you are given a multiplication puzzle where you have to replace the letters with numbers and ensure the numbers add (multiply?) up. - -You can run M-x mpuz-show-solution to solve the puzzle if you get stuck. - -### Miscellaneous - -There are more, but they’re not the most useful or interesting: - -* You can translate a region into morse code with M-x morse-region and M-x unmorse-region. - -* The Dissociated Press is a very simple command that applies something like a random walk markov-chain generator to a body of text in a buffer and generates nonsensical text from the source body. Try it with M-x dissociated-press. - -* The Gamegrid package is a generic framework for building grid-based games. So far only Tetris, Pong and Snake use it. It’s called gamegrid. - -* The gametree package is a complex way of notating and tracking chess games played via email. - -* The M-x spook command inserts random words (usually into emails) designed to confuse/overload the “NSA trunk trawler” – and keep in mind this module dates from the 1980s and 1990s – with various words the spooks are supposedly listening for. Of course, even ten years ago that would’ve seemed awfully paranoid and quaint but not so much any more… - -### Conclusion - -I love the games and playthings that ship with Emacs. A lot of them date from, well, let’s just call a different era: an era where whimsy was allowed or perhaps even encouraged. Some are known classics (like Tetris and Tower of Hanoi) and some of the others are fun variations on classics (like blackbox) — and yet I love that they ship with Emacs after all these years. I wonder if any of these would make it into Emacs’s codebase today; well, they probably wouldn’t — they’d be relegated to the package manager where, in a clean and sterile world, they no doubt belong. - -There’s a mandate in Emacs to move things not essential to the Emacs experience to ELPA, the package manager. I mean, as a developer myself, that does make sense, but… surely for every package removed and exiled to ELPA we chip away the essence of what defines Emacs? - --------------------------------------------------------------------------------- - - -via: https://www.masteringemacs.org/article/fun-games-in-emacs - -作者:[Mickey Petersen][a] -选题:[lujun9972][b] -译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.masteringemacs.org/about -[b]:https://github.com/lujun9972 -[1]:https://en.wikipedia.org/wiki/Office_Space -[2]:https://en.wikipedia.org/wiki/Tower_of_Hanoi -[3]:https://www.masteringemacs.org/article/fun-emacs-calc -[4]:http://www.xkcd.com -[5]:https://en.wikipedia.org/wiki/Battleship_(game) -[6]:https://www.masteringemacs.org/article/evaluating-elisp-emacs -[7]:https://en.wikipedia.org/wiki/ELIZA -[8]:https://en.wikipedia.org/wiki/Conway's_Game_of_Life diff --git a/translated/tech/20170918 Fun and Games in Emacs.md b/translated/tech/20170918 Fun and Games in Emacs.md new file mode 100644 index 0000000000..b4baee63b4 --- /dev/null +++ b/translated/tech/20170918 Fun and Games in Emacs.md @@ -0,0 +1,243 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fun and Games in Emacs) +[#]: via: (https://www.masteringemacs.org/article/fun-games-in-emacs) +[#]: author: (Mickey Petersen https://www.masteringemacs.org/about) + +Emacs 中的游戏与乐趣 +====== + +又是周一,你正在为你的老板 Lumbergh 努力倒腾那些 [无聊之极的文档 ][1]。为什么不玩玩 Emacs 中类似 zork 的文本冒险游戏来让你的大脑从单调的工作中解脱出来呢? + +但说真的,Emacs 中既有游戏,也有古怪的玩物。有些你可能有所耳闻。这些玩意唯一的共同点就是,它们大多是很久以前就添加到 Emacs 中的:有些东西真的是相当古怪(如您将在下面看到的),而另一些则显然是由无聊的员工或毕业生编写的。 +它们中都带着一种奇思妙想和随意性,这在今天的 Emacs 中很少见。 +Emacs 现在变得十分严肃,在某种程度上,它已经与 20 世纪 80 年代那些玩意被编写出来的时候大不一样。 + + +### 汉诺塔 + +[汉诺塔 ][2] 是一款古老的数学解密游戏,有些人可能对它很熟悉,因为它的递归和迭代解决方案经常被用与计算机科学教学辅助。 + + +![Tower of Hanoi Screenshot](https://www.masteringemacs.org/static/uploads/hanoi.png) + +Emacs 中有三个命令可以运行汉诺塔:`M-x hanoi` 默认为 3 个碟子; `M-x hanoi-unix` 和 `M-x hanoi-unix-64` 使用 unix 时间戳的位数 (32bit 或 64bit) 作为默认盘子的个数,并且每秒钟自动移动一次,两者不同之处在于后者假装使用 64 位时钟(因此有 64 个碟子)。 + +Emacs 中汉诺塔的实现可以追溯到 20 世纪 80 年代中期——确实是久得可怕。它有一些自定义选项 (`M-x customize-group RET hanoi RET`),如启用彩色光盘等。 +当你离开汉诺塔缓冲区或输入一个字符,你会收到一个讽刺的告别信息(见上文)。 + +### 5x5 + +![5x5 game grid](https://www.masteringemacs.org/static/uploads/5x5.png) + + +5x5 的游戏是一个逻辑解密游戏:你有一个 5x5 的网格,中间的十字被填满;你的目标是通过按正确的顺序切换它们的空满状态来填充所有的单元格,从而获得胜利。这并不像听起来那么容易! + +输入 `M-x 5x5` 就可以开始玩了,使用可选的数字参数可以改变网格的大小。 +这款游戏的有趣之处在于它能向你建议下一步行动并尝试解决该游戏网格。它用到了了 Emacs 自己的一款非常酷的符号 RPN 计算器 `M-x calc` (在 [Fun with Emacs Calc][3] 这篇文章中,我使用它来解决了一个简单的问题。) + +所以我喜欢这个游戏的原因是它提供了一个非常复杂的解决器——真的,你应该通过 `M-x find-library RET 5x5` 来阅读其源代码——和一个试图通过强力破解游戏的“破解器”。 + +创建一个更大的游戏网格,例如输入 `M-10 M-x 5x5`,然后运行下面某个 `crack` 命令。破坏者将尝试通过迭代获得最佳解决方案。它会实时运行该游戏,观看起来非常有趣: + +- `M-x 5x5-crack-mutating-best`: 试图通过修改最佳解决方案来破解 5x5。 + +- `M-x 5x5-crack-mutating-current`: 试图通过修改当前解决方案来破解 5x5。 + +- `M-x 5x5-crack-random`: 尝试使用随机方案解破解 5x5。 + +- `M-x 5x5-crack-xor-mutate`: 尝试通过将当前方案和最佳方案进行异或运算来破解 5x5。 + +### 文本动画 + +您可以通过运行 `M-x animation-birthday-present` 并给出名字来显示一个奇特的生日礼物动画。它看起来很酷! + +![xkcd](https://imgs.xkcd.com/comics/real_programmers.png) + +`M-x butterfly` 命令中也使用了 `animate` 包,butterfly 命令被添加到 Emacs 中,以向上面的 [XKCD][4] 漫画致敬。当然,漫画中的 Emacs 命令在技术上是无效的,但它的幽默足以弥补这一点。 + +### 黑箱 + +我将逐字引用这款游戏的目标: + +> 游戏的目标是通过向黑盒子发射光线来找到四个隐藏的球。有四种可能: +> 1) 射线将通过盒子不受干扰, +> 2) 它将击中一个球并被吸收, +> 3) 它将偏转并退出盒子,或 +> 4) 立即偏转,甚至不被允许进入盒子。 + +所以,这有点像我们小时候玩的 [Battleship][5],但是……是专为物理专业高学历的人准备的? + +这是另一款添加于 20 世纪 80 年代的游戏。我建议你输入 `C-h f blackbox` 来阅读玩法说明(文档巨大)。 + + +### 泡泡 + +![Bubbles game](https://www.masteringemacs.org/static/uploads/bubbles.png) + + +`M-x bubble` 游戏相当简单:你必须用尽可能少移动清除尽可能多的“泡泡”。当你移除气泡时,其他气泡会掉落并粘在一起。 +这是一款有趣的游戏,此外如果你使用 Emacs 的图形用户界面,它还支持图像现实。而且它还支持鼠标。 + +您可以通过调用 `M-x bubbles-set-game-< 难度>` 来设置难度,其中嗯 `<难度>` 可以是其中之一:`easy`,`medium=,=difficult`,`hard`,或 `userdefined`。 +此外,您可以使用:`M-x custom-group bubbles` 来更改图形、网格大小和颜色。 + +由于它即简单又有趣,这是 Emacs 中我最喜欢的游戏之一。 + +### 幸运饼干 + +我喜欢 `fortune` 命令。每当我启动一个新 shell 时,就会有刻薄、无益、常常带有讽刺意味的“建议(以及文学摘要,谜语)”就会点亮我的一天。 + +令人困惑的是,Emacs 中有两个包做了类似的事情:`fortune` 和 `cookie`。前者主要用于在电子邮件签名中添加幸运饼干消息,而后者只是一个简单的 fortune 格式阅读器。 + +不管怎样,使用 Emacs 的 `cookie` 包前,你首先需要通过 `customize-option RET cookie RET` 来自定义变量 `cookie-file` 告诉它从哪找到 fortune 文件。 + +如果你的操作系统是 Ubuntu,那么你先安装 `fortune` 软件包,然后就能在 `/usr/share/games/fortune/` 目录中找到这些文件了。 + +之后你就可以调用 `M-x cookie` 随机显示 fortune 内容,或者,如果你想的话,也可以调用 `M-x cookie-apropos` 查找所有匹配的 cookie。 + +### Decipher + +这个包完美地抓住了 Emacs 的实用本质:这个包为你破解简单的替换密码(如密码谜题)提供了一个很有用的界面。 +你知道,二十多年前,某人确实迫切需要破解很多基础密码。正是像这个模块这样的小玩意让我非常高兴地用起 Emacs 来:这个模块只对少数人有用,但是,如果你突然需要它了,那么它就在那里等着你。 + +那么如何使用它呢?让我们假设使用 “rot13” 密码:在 26 个字符的字母表中,将字符旋转 13 个位置。 +通过 `M-x ielm` (Emacs 用于 [运行 Elisp][6] 的 REPL 环境)可以很容易在 Emacs 中进行尝试: + + +``` +*** Welcome to IELM *** Type (describe-mode) for help. +ELISP> (rot13 "Hello, World") +"Uryyb, Jbeyq" +ELISP> (rot13 "Uryyb, Jbeyq") +"Hello, World" +ELISP> +``` + +那么,decipher 模块又是如何帮助我们的呢?让我们创建一个新的缓冲区 `test-cipher` 并输入您的密码文本(在我的例子中是 `Uryyb,Jbeyq`) + +![cipher](https://www.masteringemacs.org/static/uploads/cipher.png) + +您现在面对的是一个相当复杂的接口。现在把光标放在紫行秘文中的任意字符上,猜猜这个字符可能是什么:Emacs 将根据你的选择更新其他明文的猜测结果,并告诉你字母表中的字符是如何分配的。 + +您现在可以下面各种 helper 命令来帮助推断密码字符可能对应的明文字符: + +- **`D`:** 显示数字符号(密码中两个字符组合)及其频率的列表 + +- **`F`:** 表示每个密文字母的频率 + +- **`N`:** 显示字符的邻接信息。我不确定这是干啥的。 + +- **`M` 和 `R`:** 保存和恢复一个检查点,允许你对工作进行分支以探索破解密码的不同方法。 + +总而言之,对于这样一个深奥的任务,这个包是相当令人印象深刻的!如果你经常破解密码,也许这个程序包能帮上忙? + +### 医生 + +![doctor](https://www.masteringemacs.org/static/uploads/doctor.png) + +啊,Emacs 医生。其基于最初的 [ELIZA][7],“ 医生”试图对你说的话进行心理分析,并试图把问题复述给你。体验它的那几分钟相当有趣,它也是 Emacs 中最著名的古怪玩意之一。你可以使用 `M-x doctor` 来运行它。 + +### Dunnet + +Emacs 自己特有的类 Zork 文本冒险游戏。输入 `M-x dunnet` 就能玩了。 +这是一款相当不错的游戏,虽然时间不长,但非常著名,很少有人真正玩到最后。 + +如果你发现自己能在无聊的文档工作之间空出时间来,那么这是一个超级棒的游戏,内置“老板屏幕”,因为它是纯文本的。 + +哦,还有,不要吃掉那块 CPU 卡 :) + +### 五子棋 + +![gomoku](https://www.masteringemacs.org/static/uploads/gomoku.png) + +另一款写于 20 世纪 80 年代的游戏。你必须连接 5 个方块,井字游戏风格。你可以运行 `M-x gomoku` 来与 Emacs 对抗。游戏还支持鼠标,非常方便。您也可以自定义 `gomoku` 组来调整网格的大小。 + +### 生命游戏 + +[Conway 的生命游戏 ][8] 是细胞自动机的一个著名例子。Emacs 版本提供了一些启动模式,你可以(通过 elisp 编程)通过调整 `life-patterns` 变量来更改这些模式。 + +你可以用 `M-x life` 触发生命游戏。事实上,所有的东西,包括代码,注释和所有的东西,总共不到 300 行,这也让人印象深刻。 + +### 乒乓,贪吃蛇和俄罗斯方块 + +![tetris](https://www.masteringemacs.org/static/uploads/tetris.png) + +这些经典游戏都是使用 Emacs 包 `gamegrid` 实现的,这是一个用于构建网格游戏(如俄罗斯方块和贪吃蛇)的通用框架。gamegrid 包的伟大之处在于它同时兼容图形化和终端 Emacs: 如果你在 GUI 中运行 Emacs,你会得到精美的图形;如果你没有,你得到简单的 ASCII 艺术。 + +你可以通过输入 `M-x pong`,`M-x snake`,`M-x tetris` 来运行这些游戏。 + +特别是俄罗斯方块游戏实现的非常到位,会逐渐增加速度并且能够滑块。而且既然你已经有了源代码,你完全可以移除那个讨厌的 Z 形块,没人喜欢它! + +### Solitaire + +![solitaire image](https://www.masteringemacs.org/static/uploads/solitaire.png) + +可惜,这不是纸牌游戏,而是一个基于 peg 的游戏,你可以选择一块石头 (`o`) 并“跳过”相邻的石头进入洞中(`。`),并在这个过程中去掉你跳过的那些石头,最终只能在棋盘上留下一块石头, +重复该过程直到板子被请空(只保留一个石头)。 + +如果你卡住了,有一个内置的解题器名为 `M-x solitire-solve`。 + +### Zone + +我的另一个最爱。这是一个屏幕保护程序——或者更确切地说,是一系列的屏幕保护程序。 + +输入 `M-x zone`,然后看看屏幕上发生了什么! + +您可以通过运行 `M-x zone-when-idle` (或从 elisp 调用它)来配置屏幕保护程序的空闲时间,时间以秒为单位。 +您也可以通过 `M-x zone-leave-me-alone` 来关闭它。 + +如果它在你的同事看着的时候被启动,你的同事肯定会抓狂的。 + +### 乘法解谜 + +![mpuz](https://www.masteringemacs.org/static/uploads/mpuz.png) + +这是另一个脑筋急转弯的益智游戏。当您运行 `M-x mpuz` 时,将看到一个乘法解谜题,你必须将字母替换为对应的数字,并确保数字相加(相乘?)符合结果 + +如果遇到难题,可以运行 `M-x mpuz-show-solution` 来解决。 + +### 杂项 + +还有更多好玩的东西,但它们就不如刚才那些那么好玩好用了: + +- 你可以通过 `M-x morse-region` 和 `M-x unmorse-region` 将一个区域翻译成莫尔斯电码。 +- Dissociated Press 是一个非常简单的命令,它将类似随机游动 markov 链生成器应用到 buffer 中的文本中,并以此生成无意义的文本。试一下 `M-x dissociated-press`。 +- Gamegrid 包是构建网格游戏的通用框架。到目前为止,只有俄罗斯方块,乒乓和贪吃蛇使用了它。其名为 `gamegrid`。 +- `gametree` 软件包是一个通过电子邮件记录和跟踪国际象棋游戏的复杂方法。 +- `M-x spook` 命令插入随机单词(通常是在电子邮件中),目的是混淆/超载 “NSA trukn trawler”—— 记住,这个模块可以追溯到 20 世纪 80 年代和 90 年代——那时应该有间谍们在监听各种单词。当然,即使是在十年前,这样做也会显得非常偏执和古怪,不过现在看来已经不那么奇怪了…… + + +### 结论 + +我喜欢 Emacs 附带的游戏和玩具。它们大多来自于,嗯,我们姑且称之为一个不同的时代:一个允许或甚至鼓励奇思妙想的时代。 +有些玩意非常经典(如俄罗斯方块和汉诺塔),有些对经典游戏进行了有趣的变种(如黑盒)——但我很高兴这么多年后他们依然在 Emacs 中。 +我想知道时至今日,这些玩意是否还会纳入 Emacs 的代码库中;嗯,它们很可能不会——它们将被归入包管理仓库中,而在这个干净而贫瘠的世界中,它们无疑属于包管理仓库。 + +Emacs 要求将对 Emacs 体验不重要的内容转移到包管理仓库 ELPA 中。我的意思是,作为一个开发者,这是有道理的,但是……对于每一个被移出并流放到 ELPA 的包,我们都在蚕食 Emacs 的精髓。 + +-------------------------------------------------------------------------------- + + +via: https://www.masteringemacs.org/article/fun-games-in-emacs + +作者:[Mickey Petersen][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.masteringemacs.org/about +[b]:https://github.com/lujun9972 +[1]:https://en.wikipedia.org/wiki/Office_Space +[2]:https://en.wikipedia.org/wiki/Tower_of_Hanoi +[3]:https://www.masteringemacs.org/article/fun-emacs-calc +[4]:http://www.xkcd.com +[5]:https://en.wikipedia.org/wiki/Battleship_(game) +[6]:https://www.masteringemacs.org/article/evaluating-elisp-emacs +[7]:https://en.wikipedia.org/wiki/ELIZA +[8]:https://en.wikipedia.org/wiki/Conway's_Game_of_Life From e489106ae61814084bd69d6f40b31b9fb975f480 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 22 Feb 2020 19:39:37 +0800 Subject: [PATCH 037/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190114=20Some?= =?UTF-8?q?=20Advice=20for=20How=20to=20Make=20Emacs=20Tetris=20Harder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md --- ...ice for How to Make Emacs Tetris Harder.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sources/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md diff --git a/sources/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md b/sources/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md new file mode 100644 index 0000000000..829dd3703f --- /dev/null +++ b/sources/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Some Advice for How to Make Emacs Tetris Harder) +[#]: via: (https://nickdrozd.github.io/2019/01/14/tetris.html) +[#]: author: (nickdrozd https://nickdrozd.github.io) + +Some Advice for How to Make Emacs Tetris Harder +====== + +Did you know that Emacs comes bundled with an implementation of Tetris? Just hit M-x tetris and there it is: + +![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-normal.png) + +This is often mentioned by Emacs advocates in text editor discussions. “Yeah, but can that other editor run Tetris?” I wonder, is that supposed to convince anyone that Emacs is superior? Like, why would anyone care that they could play games in their text editor? “Yeah, but can that other vacuum play mp3s?” + +That said, Tetris is always fun. Like everything in Emacs, the source code is open for easy inspection and modifcation, so it’s possible to make it even more fun. And by more fun, I mean harder. + +One of the simplest ways to make the game harder is to get rid of the next-block preview. No more sitting that S/Z block in a precarious position knowing that you can fill in the space with the next piece – you have to chance it and hope for the best. Here’s what it looks like with no preview (as you can see, without the preview I made some choices that turned out to have dire consequences): + +![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-no-preview.png) + +The preview box is set with a function called tetris-draw-next-shape[1][2]: + +``` +(defun tetris-draw-next-shape () + (dotimes (x 4) + (dotimes (y 4) + (gamegrid-set-cell (+ tetris-next-x x) + (+ tetris-next-y y) + tetris-blank))) + (dotimes (i 4) + (let ((tetris-shape tetris-next-shape) + (tetris-rot 0)) + (gamegrid-set-cell (+ tetris-next-x + (aref (tetris-get-shape-cell i) 0)) + (+ tetris-next-y + (aref (tetris-get-shape-cell i) 1)) + tetris-shape)))) +``` + +First, we’ll introduce a flag to allow configuring next-preview[2][3]: + +``` +(defvar tetris-preview-next-shape nil + "When non-nil, show the next block the preview box.") +``` + +Now the question is, how can we make tetris-draw-next-shape obey this flag? The obvious way would be to redefine it: + +``` +(defun tetris-draw-next-shape () + (when tetris-preview-next-shape + ;; existing tetris-draw-next-shape logic + )) +``` + +This is not an ideal solution. There will be two definitions of the same function floating around, which is confusing, and we’ll have to maintain our modified definition in case the upstream version changes. + +A better approach is to use advice. Emacs advice is like a Python decorator, but even more flexible, since advice can be added to a function from anywhere. This means that we can modify the function without disturbing the original source file at all. + +There are a lot of different ways to use Emacs advice ([check the manual][4]), but for now we’ll just stick with the advice-add function with the :around flag. The advising function takes the original function as an argument, and it might or might not execute it. In this case, we’ll say that the original should be executed only if the preview flag is non-nil: + +``` +(defun tetris-maybe-draw-next-shape (tetris-draw-next-shape) + (when tetris-preview-next-shape + (funcall tetris-draw-next-shape))) + +(advice-add 'tetris-draw-next-shape :around #'tetris-maybe-draw-next-shape) +``` + +This code will modify the behavior of tetris-draw-next-shape, but it can be stored in your config files, safely away from the actual Tetris code. + +Getting rid of the preview box is a simple change. A more drastic change is to make it so that blocks randomly stop in the air: + +![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-air.png) + +In that picture, the red I and green T pieces are not falling, they’re set in place. This can make the game almost unplayably hard, but it’s easy to implement. + +As before, we’ll first define a flag: + +``` +(defvar tetris-stop-midair t + "If non-nil, pieces will sometimes stop in the air.") +``` + +Now, the way Emacs Tetris works is something like this. The active piece has x- and y-coordinates. On each clock tick, the y-coordinate is incremented (the piece moves down one row), and then a check is made for collisions. If a collision is detected, the piece is backed out (its y-coordinate is decremented) and set in place. In order to make a piece stop in the air, all we have to do is hack the detection function, tetris-test-shape. + +It doesn’t matter what this function does internally – what matters is that it’s a function of no arguments that returns a boolean value. We need it to return true whenever it normally would (otherwise we risk weird collisions) but also at other times. I’m sure there are a variety of ways this could be done, but here is what I came up with: + +``` +(defun tetris-test-shape-random (tetris-test-shape) + (or (and + tetris-stop-midair + ;; Don't stop on the first shape. + (< 1 tetris-n-shapes ) + ;; Stop every INTERVAL pieces. + (let ((interval 7)) + (zerop (mod tetris-n-shapes interval))) + ;; Don't stop too early (it makes the game unplayable). + (let ((upper-limit 8)) + (< upper-limit tetris-pos-y)) + ;; Don't stop at the same place every time. + (zerop (mod (random 7) 10))) + (funcall tetris-test-shape))) + +(advice-add 'tetris-test-shape :around #'tetris-test-shape-random) +``` + +The hardcoded parameters here were chosen to make the game harder but still playable. I was drunk on an airplane when I decided on them though, so they might need some further tweaking. + +By the way, according to my tetris-scores file, my top score is + +``` +01389 Wed Dec 5 15:32:19 2018 +``` + +The scores in that file are listed up to five digits by default, so that doesn’t seem very good. + +Exercises for the reader + +1. Using advice, modify Emacs Tetris so that it flashes the messsage “OH SHIT” under the scoreboard every time the block moves down. Make the size of the message proportional to the height of the block stack (when there are no blocks, the message should be small or nonexistent, and when the highest block is close to the ceiling, the message should be large). + +2. The version of tetris-test-shape-random given here has every seventh piece stop midair. A player could potentially figure out the interval and use it to their advantage. Modify it to make the interval random in some reasonable range (say, every five to ten pieces). + +3. For a different take on advising Tetris, try out [autotetris-mode][1]. + +4. Come up with an interesting way to mess with the piece-rotation mechanics and then implement it with advice. + +Footnotes +============================================================ + +[1][5] Emacs has just one big global namespace, so function and variable names are typically prefixed with their package name in order to avoid collisions. + +[2][6] A lot of people will tell you that you shouldn’t use an existing namespace prefix and that you should reserve a namespace prefix for anything you define yourself, e.g. my/tetris-preview-next-shape. This is ugly and usually pointless, so I don’t do it. + +-------------------------------------------------------------------------------- + +via: https://nickdrozd.github.io/2019/01/14/tetris.html + +作者:[nickdrozd][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://nickdrozd.github.io +[b]: https://github.com/lujun9972 +[1]: https://nullprogram.com/blog/2014/10/19/ +[2]: https://nickdrozd.github.io/2019/01/14/tetris.html#fn.1 +[3]: https://nickdrozd.github.io/2019/01/14/tetris.html#fn.2 +[4]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html +[5]: https://nickdrozd.github.io/2019/01/14/tetris.html#fnr.1 +[6]: https://nickdrozd.github.io/2019/01/14/tetris.html#fnr.2 From f0b8a0dda256494e894a094a48dfd79fd133bc39 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 22 Feb 2020 20:06:47 +0800 Subject: [PATCH 038/260] translate done: 20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md --- ...romium - Firefox sessions with org-mode.md | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) rename {sources => translated}/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md (57%) diff --git a/sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md b/translated/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md similarity index 57% rename from sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md rename to translated/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md index 7b71e21ff3..7c1bf841df 100644 --- a/sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md +++ b/translated/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md @@ -7,16 +7,16 @@ [#]: via: (https://acidwords.com/posts/2019-12-04-handle-chromium-and-firefox-sessions-with-org-mode.html) [#]: author: (Sanel Z https://acidwords.com/) -Handle Chromium & Firefox sessions with org-mode +通过 org-mode 管理 Chromium 和 Firefox 会话 ====== -I was big fan of [Session Manager][1], small addon for Chrome and Chromium that will save all open tabs, assign the name to session and, when is needed, restore it. +我是 [Session Manager][1] 的大粉丝,它是 Chrome 和 Chromium 的小插件,可以保存所有打开的选项卡,为会话命名,并在需要时恢复会话。 -Very useful, especially if you are like me, switching between multiple "mind sessions" during the day - research, development or maybe news reading. Or simply, you'd like to remember workflow (and tabs) you had few days ago. +它非常有用,特别是如果你像我一样,白天的时候需要在多个“思维活动”之间切换——研究、开发或者新闻阅读。或者您只是单纯地希望记住几天前的工作流(和选项卡)。 -After I decided to ditch all extensions from Chromium except [uBlock Origin][2], it was time to look for alternative. My main goal was it to be browser agnostic and session links had to be stored in text file, so I can enjoy all the goodies of plain text file. What would be better for that than good old [org-mode][3] ;) +在我决定放弃 chromium 上除了 [uBlock Origin][2] 之外的所有扩展后,也到了寻找替代品的时候了。我的主要目标是使之与浏览器无关同时会话链接需要保存在文本文件中,这样我就可以享受所有纯文本的好处了。还有什么比 [org-mode][3] 更好呢 ;) -Long time ago I found this trick: [Get the currently open tabs in Google Chrome via the command line][4] and with some elisp sugar and coffee, here is the code: +很久以前我就发现了这个小诀窍:[通过命令行获取当前在谷歌 Chrome 中打开的标签 ][4] 再加上些 elisp 代码: ``` (require 'cl-lib) @@ -57,9 +57,9 @@ Make sure to put cursor on date heading that contains list of urls." (forward-line 1))))) ``` -So, how does it work? +那么,它的工作原理是什么呢? -Evaluate above code, open new org-mode file and call `M-x save-chromium-session`. It will create something like this: +运行上述代码,打开一个新 org-mode 文件并调用 `M-x save-chromium-session`。它会创建类似这样的东西: ``` * [2019-12-04 12:14:02] @@ -68,9 +68,9 @@ Evaluate above code, open new org-mode file and call `M-x save-chromium-session` - https://news.ycombinator.com ``` -or whatever urls are running in Chromium instance. To restore it back, put cursor on desired date and run `M-x restore-chromium-session`. All tabs should be back. +也就是任何在 chromium 实例中运行着的 URL。要还原的话,则将光标置于所需日期上然后运行 `M-x restore-chromium-session`。所有标签都应该恢复了。 -Here is how I use it, with randomly generated data for the purpose of this text: +以下是我的使用案例,其中的数据是随机生成的: ``` #+TITLE: Browser sessions @@ -88,27 +88,28 @@ Here is how I use it, with randomly generated data for the purpose of this text: - https://news.ycombinator.com ``` -Note that hack for reading Chromium session isn't perfect: `strings` will read whatever looks like string and url from binary database and sometimes that will yield small artifacts in urls. But, you can easily edit those and keep session file lean and clean. +请注意,用于读取 Chromium 会话的方法并不完美:`strings` 将从二进制数据库中读取任何类似 URL 字符串的内容,有时这将产生不完整的 url。不过,您可以很方便地地编辑它们,从而保持会话文件简洁。 -To actually open tabs, elisp code will use [browse-url][5] and it can be further customized to run Chromium, Firefox or any other browser with `browse-url-browser-function` variable. Make sure to read documentation for this variable. +为了真正打开标签,elisp 代码中使用到了 [browse-url][5],它可以通过 `browse-url-browser-function` 变量进一步定制成运行 Chromium,Firefox 或任何其他浏览器。请务必阅读该变量的相关文档。 -Don't forget to put session file in git, mercurial or svn and enjoy the fact that you will never loose your session history again :) +别忘了把会话文件放在 git、mercurial 或 svn 中,这样你就再也不会丢失会话历史记录了 :) -### What about Firefox? +### 那么 Firefox 呢? -If you are using Firefox (recent versions) and would like to pull session urls, here is how to do it. +如果您正在使用 Firefox( 最近的版本),并且想要获取会话 url,下面是操作方法。 -First, download and compile [lz4json][6], small tool that will decompress Mozilla lz4json format, where Firefox stores session data. Session data (at the time of writing this post) is stored in `$HOME/.mozilla/firefox//sessionstore-backups/recovery.jsonlz4`. +首先,下载并编译 [lz4json][6],这是一个可以解压缩 Mozilla lz4json 格式的小工具,Firefox 以这种格式来存储会话数据。会话数据(在撰写本文时)存储在 `$HOME/.mozilla/firefox//sessionstore-backup /recovery.jsonlz4` 中。 -If Firefox is not running, `recovery.jsonlz4` will not be present, but use `previous.jsonlz4` instead. +如果 Firefox 没有运行,则没有 `recovery.jsonlz4`,这种情况下用 `previous.jsonlz4` 代替。 +=恢复。jsonlz4= 将不存在,但使用=先前。jsonlz4 =。 -To extract urls, try this in terminal: +要提取网址,尝试在终端运行: ``` $ lz4jsoncat recovery.jsonlz4 | grep -oP '"(http.+?)"' | sed 's/"//g' | sort | uniq ``` -and update `save-chromium-session` with: +然后更新 `save-chromium-session` 为: ``` (defun save-chromium-session () @@ -122,7 +123,7 @@ and update `save-chromium-session` with: ;; rest of the code is unchanged ``` -Updating documentation strings, function name and any further refactoring is left for exercise. +更新本函数的文档字符串、函数名以及进一步的重构都留作练习。 -------------------------------------------------------------------------------- From 5990054324fe2ab73fa271d258c8ffd1b257050c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 23 Feb 2020 00:58:53 +0800 Subject: [PATCH 039/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200222=20How=20?= =?UTF-8?q?to=20install=20TT-RSS=20on=20a=20Raspberry=20Pi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md --- ...How to install TT-RSS on a Raspberry Pi.md | 245 ++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md diff --git a/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md b/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md new file mode 100644 index 0000000000..ec5a177314 --- /dev/null +++ b/sources/tech/20200222 How to install TT-RSS on a Raspberry Pi.md @@ -0,0 +1,245 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to install TT-RSS on a Raspberry Pi) +[#]: via: (https://opensource.com/article/20/2/ttrss-raspberry-pi) +[#]: author: (Patrick H. Mullins https://opensource.com/users/pmullins) + +How to install TT-RSS on a Raspberry Pi +====== +Read your news feeds while keeping your privacy intact with Tiny Tiny +RSS. +![Raspberries with pi symbol overlay][1] + +[Tiny Tiny RSS][2] (TT-RSS) is a free and open source web-based news feed (RSS/Atom) reader and aggregator. It's ideally suited to those who are privacy-focused and still rely on RSS for their daily news. Tiny Tiny RSS is self-hosted software, so you have 100% control of the server, your data, and your overall privacy. It also supports a wide range of plugins, add-ons, and themes, Want a dark mode interface? No problem. Want to filter your incoming news based on keywords? TT-RSS has you covered there, as well. + +![Tiny Tiny RSS screenshot][3] + +Now that you know what TT-RSS is and why you may want to use it, I'll explain everything you need to know about installing it on a Raspberry Pi or a Debian 10 server. + +### Install and configure TT-RSS + +To install TT-RSS on a Raspberry Pi, you must also install and configure the latest version of PHP (7.3 as of this writing), PostgreSQL for the database backend, the Nginx web server, Git, and finally, TT-RSS. + +#### 1\. Install PHP 7 + +Installing PHP 7 is, by far, the most involved part of this process. Thankfully, it's not as difficult as it might appear. Start by installing the following support packages: + + +``` +`$ sudo apt install -y ca-certificates apt-transport-https` +``` + +Now, add the repository PGP key: + + +``` +`$ wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -` +``` + +Next, add the PHP repository to your apt sources: + + +``` +`$ echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list` +``` + +Then update your repository index: + + +``` +`$ sudo apt update` +``` + +Finally, install PHP 7.3 (or the latest version) and some common components: + + +``` +`$ sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-opcache php7.3-curl php7.3-mbstring php7.3-pgsql php7.3-zip php7.3-xml php7.3-gd php7.3-intl` +``` + +The command above assumes you're using PostgreSQL as your database backend and installs **php7.3-pgsql**. If you'd rather use MySQL or MariaDB, you can easily change this to **php7.3-mysql**. + +Next, verify that PHP is installed and running on your Raspberry Pi: + + +``` +`$ php -v` +``` + +Now it's time to install and configure the webserver. + +#### 2\. Install Nginx + +Nginx can be installed via apt with: + + +``` +`$ sudo apt install -y nginx` +``` + +Modify the default Nginx virtual host configuration so that the webserver will recognize PHP files and know what to do with them: + + +``` +`$ sudo nano /etc/nginx/sites-available/default` +``` + +You can safely delete everything in the original file and replace it with: + + +``` +server { +        listen 80 default_server; +        listen [::]:80 default_server; + +        root /var/www/html; +        index index.html index.htm index.php; +        server_name _; + +        location / { +                try_files $uri $uri/ =404; +        } + +        location ~ \\.php$ { +          include snippets/fastcgi-php.conf; +          fastcgi_pass unix:/run/php/php7.3-fpm.sock; +        } + +} +``` + +Use **Ctrl+O** to save your new configuration file and then **Ctrl+X** to exit Nano. You can test your new configuration with: + + +``` +`$ nginx -t` +``` + +If there are no errors, restart the Nginx service: + + +``` +`$ systemctl restart nginx` +``` + +#### 3\. Install PostgreSQL + +Next up is installing the database server. Installing PostgreSQL on the Raspberry Pi is super easy: + + +``` +`$ sudo apt install -y postgresql postgresql-client postgis` +``` + +Check to see if the database server was successfully installed by entering: + + +``` +`$ psql --version` +``` + +#### 4\. Create the Tiny Tiny RSS database + +Before you can do anything else, you need to create a database that the TT-RSS software will use to store data. First, log into the PostgreSQL server: + + +``` +`sudo -u postgres psql` +``` + +Next, create a new user and assign a password: + + +``` +`CREATE USER username WITH PASSWORD 'your_password' VALID UNTIL 'infinity';` +``` + +Then create the database that will be used by TT-RSS: + + +``` +`CREATE DATABASE tinyrss;` +``` + +Finally, grant full permissions to the new user: + + +``` +`GRANT ALL PRIVILEGES ON DATABASE tinyrss to user_name;` +``` + +That's it for the database. You can exit the **psql** app by typing **\q**. + +#### 5\. Install Git + +Installing TT-RSS requires Git, so install Git with: + + +``` +`$ sudo apt install git -y` +``` + +Now, change directory to wherever Nginx serves web pages: + + +``` +`$ cd /var/www/html` +``` + +Then download the latest source for TT-RSS: + + +``` +`$ git clone https://git.tt-rss.org/fox/tt-rss.git tt-rss` +``` + +Note that this process creates a new **tt-rss** folder. + +#### 6\. Install and configure Tiny Tiny RSS + +It's finally time to install and configure your new TT-RSS server. First, verify that you can open **** in a web browser. If you get a **403 Forbidden** error, your permissions are not set properly on the **/var/www/html** folder. The following will usually fix this issue: + + +``` +`$ chmod 755 /var/www/html/ -v` +``` + +If everything goes as planned, you'll see the TT-RSS Installer page, and it will ask you for some database information. Just tell it the database username and password that you created earlier; the database name; **localhost** for the hostname; and **5432** for the port. + +Click **Test Configuration** to continue. If all went well, you should see a red button labeled **Initialize Database.** Click on it to begin the installation. Once finished, you'll have a configuration file that you can copy and save as **config.php** in the TT-RSS directory. + +After finishing with the installer, open your TT-RSS installation at **** and log in with the default credentials (username: **admin**, password: **password**). The system will recommend that you change the admin password as soon as you log in. I highly recommend that you follow that advice and change it as soon as possible. + +### Set up TT-RSS + +If all went well, you can start using TT-RSS right away. It's recommended that you create a new non-admin user, log in as the new user, and start importing your feeds, subscribing, and configuring it as you see fit. + +Finally, and this is super important, don't forget to read the [Updating Feeds][4] section on TT-RSS's wiki. It describes how to create a simple systemd service that will update your feeds. If you skip this step, your RSS feeds will not update automatically. + +### Conclusion + +Whew! That was a lot of work, but you did it! You now have your very own RSS aggregation server. Want to learn more about TT-RSS? I recommend checking out the official [FAQ][5], the [support][6] forum, and the detailed [installation][7] notes. Feel free to comment below if you have any questions or issues. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/ttrss-raspberry-pi + +作者:[Patrick H. 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]: https://opensource.com/users/pmullins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay) +[2]: https://tt-rss.org/ +[3]: https://opensource.com/sites/default/files/uploads/tt-rss.jpeg (Tiny Tiny RSS screenshot) +[4]: https://tt-rss.org/wiki/UpdatingFeeds +[5]: https://tt-rss.org/wiki/FAQ +[6]: https://community.tt-rss.org/c/tiny-tiny-rss/support +[7]: https://tt-rss.org/wiki/InstallationNotes From 86c34d6f8d7a5ebed0024e1f246f5b505034c46f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 23 Feb 2020 00:59:46 +0800 Subject: [PATCH 040/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200221=20Live?= =?UTF-8?q?=20video=20streaming=20with=20open=20source=20Video.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200221 Live video streaming with open source Video.js.md --- ...deo streaming with open source Video.js.md | 171 ++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 sources/tech/20200221 Live video streaming with open source Video.js.md diff --git a/sources/tech/20200221 Live video streaming with open source Video.js.md b/sources/tech/20200221 Live video streaming with open source Video.js.md new file mode 100644 index 0000000000..178466a443 --- /dev/null +++ b/sources/tech/20200221 Live video streaming with open source Video.js.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Live video streaming with open source Video.js) +[#]: via: (https://opensource.com/article/20/2/video-streaming-tools) +[#]: author: (Aaron J. Prisk https://opensource.com/users/ricepriskytreat) + +Live video streaming with open source Video.js +====== +Video.js is a widely used protocol that will serve your live video +stream to a wide range of devices. +![video editing dashboard][1] + +Last year, I wrote about [creating a video streaming server with Linux][2]. That project uses the Real-Time Messaging Protocol (RMTP), Nginx web server, Open Broadcast Studio (OBS), and VLC media player. + +I used VLC to play our video stream, which may be fine for a small local deployment but isn't very practical on a large scale. First, your viewers have to use VLC, and RTMP streams can provide inconsistent playback. This is where [Video.js][3] comes into play! Video.js is an open source JavaScript framework for creating custom HTML5 video players. Video.js is incredibly powerful, and it's used by a host of very popular websites—largely due to its open nature and how easy it is to get up and running. + +### Get started with Video.js + +This project is based off of the video streaming project I wrote about last year. Since that project was set to serve RMTP streams, to use Video.js, you'll need to make some adjustments to that Nginx configuration. HTTP Live Streaming ([HLS][4]) is a widely used protocol developed by Apple that will serve your stream better to a multitude of devices. HLS will take your stream, break it into chunks, and serve it via a specialized playlist. This allows for a more fault-tolerant stream that can play on more devices. + +First, create a directory that will house the HLS stream and give Nginx permission to write to it: + + +``` +mkdir /mnt/hls +chown www:www /mnt/hls +``` + +Next, fire up your text editor, open the Nginx.conf file, and add the following under the **application live** section: + + +``` +       application live { +            live on; +            # Turn on HLS +            hls on; +            hls_path /mnt/hls/; +            hls_fragment 3; +            hls_playlist_length 60; +            # disable consuming the stream from nginx as rtmp +            deny play all; +} +``` + +Take note of the HLS fragment and playlist length settings. You may want to adjust them later, depending on your streaming needs, but this is a good baseline to start with. Next, we need to ensure that Nginx is able to listen for requests from our player and understand how to present it to the user. So, we'll want to add a new section at the bottom of our nginx.conf file. + + +``` +server { +        listen 8080; + +        location / { +            # Disable cache +            add_header 'Cache-Control' 'no-cache'; + +            # CORS setup +            add_header 'Access-Control-Allow-Origin' '*' always; +            add_header 'Access-Control-Expose-Headers' 'Content-Length'; + +            # allow CORS preflight requests +            if ($request_method = 'OPTIONS') { +                add_header 'Access-Control-Allow-Origin' '*'; +                add_header 'Access-Control-Max-Age' 1728000; +                add_header 'Content-Type' 'text/plain charset=UTF-8'; +                add_header 'Content-Length' 0; +                return 204; +            } + +            types { +                application/dash+xml mpd; +                application/vnd.apple.mpegurl m3u8; +                video/mp2t ts; +            } + +            root /mnt/; +        } +    } +``` + +Visit Video.js's [Getting started][5] page to download the latest release and check out the release notes. Also on that page, Video.js has a great introductory template you can use to create a very basic web player. I'll break down the important bits of that template and insert the pieces you need to get your new HTML player to use your stream. + +The **head** links in the Video.js library from a content-delivery network (CDN). You can also opt to download and store Video.js locally on your web server if you want. + + +``` +<head> +  <link href="" rel="stylesheet" /> + +  <!-- If you'd like to support IE8 (for Video.js versions prior to v7) --> +  <script src="[https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"\>\][6]</script> +</head> +``` + +Now to the real meat of the player. The **body** section sets the parameters of how the video player will be displayed. Within the **video** element, you need to define the properties of your player. How big do you want it to be? Do you want it to have a poster (i.e., a thumbnail)? Does it need any special player controls? This example defines a simple 600x600 pixel player with an appropriate (to me) thumbnail featuring Beastie (the BSD Demon) and Tux (the Linux penguin). + + +``` +<body> +  <video +    id="my-video" +    class="video-js" +    controls +    preload="auto" +    width="600" +    height="600" +    poster="BEASTIE-TUX.jpg" +    data-setup="{}" +  > +``` + +Now that you've set how you want your player to look, you need to tell it what to play. Video.js can handle a large number of different formats, including HLS streams. + + +``` +    <source src="" type="application/x-mpegURL" /> +    <p class="vjs-no-js"> +      To view this video please enable JavaScript, and consider upgrading to a +      web browser that +      <a href="" target="_blank" +        >supports HTML5 video</a +      > +    </p> +  </video> +``` + +### Record your streams + +Keeping a copy of your streams is super easy. Just add the following at the bottom of your **application live** section in the nginx.conf file: + + +``` +# Enable stream recording +record all; +record_path /mnt/recordings/; +record_unique on; +``` + +Make sure that **record_path** exists and that Nginx has permissions to write to it: + + +``` +`chown -R www:www /mnt/recordings` +``` + +### Down the stream + +That's it! You should now have a spiffy new HTML5-friendly live video player. There are lots of great resources out there on how to expand all your video-making adventures. If you have any questions or suggestions, feel free to reach out to me on [Twitter][7] or leave a comment below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/video-streaming-tools + +作者:[Aaron J. Prisk][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/ricepriskytreat +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/video_editing_folder_music_wave_play.png?itok=-J9rs-My (video editing dashboard) +[2]: https://opensource.com/article/19/1/basic-live-video-streaming-server +[3]: https://videojs.com/ +[4]: https://en.wikipedia.org/wiki/HTTP_Live_Streaming +[5]: https://videojs.com/getting-started +[6]: https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"\>\ +[7]: https://twitter.com/AKernelPanic From 3298cd109b9c84b6723976c1201f73ffbb01ad51 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 23 Feb 2020 01:01:50 +0800 Subject: [PATCH 041/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200221=20Don't?= =?UTF-8?q?=20like=20loops=3F=20Try=20Java=20Streams?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200221 Don-t like loops- Try Java Streams.md --- ...0221 Don-t like loops- Try Java Streams.md | 427 ++++++++++++++++++ 1 file changed, 427 insertions(+) create mode 100644 sources/tech/20200221 Don-t like loops- Try Java Streams.md diff --git a/sources/tech/20200221 Don-t like loops- Try Java Streams.md b/sources/tech/20200221 Don-t like loops- Try Java Streams.md new file mode 100644 index 0000000000..e327d045a3 --- /dev/null +++ b/sources/tech/20200221 Don-t like loops- Try Java Streams.md @@ -0,0 +1,427 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Don't like loops? Try Java Streams) +[#]: via: (https://opensource.com/article/20/2/java-streams) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +Don't like loops? Try Java Streams +====== +It's 2020 and time to learn about Java Streams. +![Person drinking a hat drink at the computer][1] + +In this article, I will explain how to not write loops anymore. + +What? Whaddaya mean, no more loops? + +Yep, that's my 2020 resolution—no more loops in Java. Understand that it's not that loops have failed me, nor have they led me astray (well, at least, I can argue that point). Really, it is that I, a Java programmer of modest abilities since 1997 or so, must finally learn about all this new [Streams][2] stuff, saying "what" I want to do and not "how" I want to do it, maybe being able to parallelize some of my computations, and all that other good stuff. + +I'm guessing that there are other Java programmers out there who also have been programming in Java for a decent amount of time and are in the same boat. Therefore, I'm offering my experiences as a guide to "how to not write loops in Java anymore." + +### Find a problem worth solving + +If you're like me, then the first show-stopper you run into is "right, cool stuff, but what am I solving for, and how do I apply this?" I realized that I can spot the perfect opportunity camouflaged as _Something I've Done Before_. + +In my case, it's sampling land cover within a specific area and coming up with an estimate and a confidence interval around that estimate for the land cover across the whole area. The specific problem involves deciding whether an area is "forested" or not, given a specific legal definition: if at least 10% of the soil is covered over by tree crowns, then the area is considered to be forested; otherwise, it's something else. + +![Image of land cover in an area][3] + +It's a pretty esoteric example of a recurring problem; I'll grant you. But there it is. For the ecologists and foresters out there who are accustomed to cool temperate or tropical forests, 10% might sound kind of low, but in the case of dry areas with low-growing shrubs and trees, that's a reasonable number. + +So the basic idea is: use images to stratify the area (i.e., areas completely devoid of trees, areas of predominantly small trees spaced quite far apart, areas of predominantly small trees spaced closer together, areas of somewhat larger trees), locate some samples in those strata, send the crew out to measure the samples, analyze the results, and calculate the proportion of soil covered by tree crowns across the area. Simple, right? + +![Survey team assessing land cover][4] + +### What the field data looks like + +In the current project, the samples are rectangular areas 20 meters wide by 25 meters long, so 500 square meters each. On each patch, the field crew measured each tree: its species, its height, the maximum and minimum width of its crown, and the diameter of its trunk at trunk height (nominally 30cm above the ground). This information was collected, entered into a spreadsheet, and exported to a bar separated value (BSV) file for me to analyze. It looks like this: + +Stratum# | Sample# | Tree# | Species | Trunk diameter (cm) | Crown diameter 1 (m) | Crown diameter 2 (m) | Height (m) +---|---|---|---|---|---|---|--- +1 | 1 | 1 | Ac | 6 | 3.6 | 4.6 | 2.4 +1 | 1 | 2 | Ac | 6 | 2.2 | 2.3 | 2.5 +1 | 1 | 3 | Ac | 16 | 2.5 | 1.7 | 2.4 +1 | 1 | 4 | Ac | 6 | 1.5 | 2.1 | 1.8 +1 | 1 | 5 | Ac | 5 | 0.9 | 1.7 | 1.7 +1 | 1 | 6 | Ac | 6 | 1.7 | 1.3 | 1.6 +1 | 1 | 7 | Ac | 5 | 1.82 | 1.32 | 1.8 +1 | 1 | 1 | Ac | 1 | 0.3 | 0.25 | 0.9 +1 | 1 | 2 | Ac | 2 | 1.2 | 1.2 | 1.7 + +The first column is the stratum number (where 1 is "predominantly small trees spaced quite far apart," 2 is "predominantly small trees spaced closer together," and 3 is "somewhat larger trees"; we didn't sample the areas "completely devoid of trees"). The second column is the sample number (there are 73 samples altogether, located in the three strata in proportion to the area of each stratum). The third column is the tree number within the sample. The fourth is the two-letter species code, the fifth the trunk diameter (in this case, 10cm above ground or exposed roots), the sixth the smallest distance across the crown, the seventh the largest distance, and the eighth the height of the tree. + +For the purposes of this exercise, I'm only concerned with the total amount of ground covered by the tree crowns—not the species, nor the height, nor the diameter of the trunk. + +In addition to the measurement information above, I also have the areas of the three strata, also in a BSV: + +stratum | hectares +---|--- +1 | 114.89 +2 | 207.72 +3 | 29.77 + +### What I want to do (not how I want to do it) + +In keeping with one of the main design goals of Java Streams, here is "what" I want to do: + + 1. Read the stratum area BSV and save the data as a lookup table. + 2. Read the measurements from the measurement BSV file. + 3. Accumulate each measurement (tree) to calculate the total area of the sample covered by tree crowns. + 4. Accumulate the sample tree crown area values and count the number of samples to estimate the mean tree crown area coverage and standard error of the mean for each stratum. + 5. Summarize the stratum figures. + 6. Weigh the stratum means and standard errors by the stratum areas (looked up from the table created in step 1) and accumulate them to estimate the mean tree crown area coverage and standard error of the mean for the total area. + 7. Summarize the weighted figures. + + + +Generally speaking, the way to define "what" with Java Streams is by creating a stream processing pipeline of function calls that pass over the data. So, yes, there is actually a bit of "how" that ends up creeping in… in fact, quite a bit of "how." But, it needs a very different knowledge base than the good, old fashioned loop. + +I'll go through each of these steps in detail. + +#### Build the stratum area table + +The first job is to convert the stratum areas BSV file to a lookup table: + + +``` +[String][5] fileName = "stratum_areas.bsv"; +Stream<String> inputLineStream = Files.lines(Paths.get(fileName));  // (1) + +final Map<[Integer][6],Double> stratumAreas =   // (2) +    inputLineStream     // (3) +        .skip(1)                   // (4) +        .map(l -> l.split("\\\|"))  // (5) +        .collect(                  // (6) +            Collectors.toMap(      // (7) +                a -> [Integer][6].parseInt(a[0]),  // (8) +                a -> [Double][7].parseDouble(a[1]) // (9) +            ) +        ); +inputLineStream.close();   // (10) + +[System][8].out.println("stratumAreas = " + stratumAreas);  // (11) +``` + +I'll take this a line or two at a time, where the numbers in comments following the lines above—e.g., _// (3)_— correspond to the numbers below: + + 1. java.nio.Files.lines() gives a stream of strings corresponding to lines in the file. + 2. The goal is to create the lookup table, **stratumAreas**, which is a **Map<Integer,Double>**. Therefore, I can get the **double** value area for stratum 2 as **stratumAreas.get(2)**. + 3. This is the beginning of the stream "pipeline." + 4. Skip the first line in the pipeline since it's the header line containing the column names. + 5. Use **map()** to split the **String** input line into an array of **String** fields, with the first field being the stratum # and the second being the stratum area. + 6. Use **collect()** to [materialize the results][9]. + 7. The materialized result will be produced as a sequence of **Map** entries. + 8. The key of each map entry is the first element of the array in the pipeline—the **int** stratum number. By the way, this is a _Java lambda_ expression—[an anonymous function][10] that takes an argument and returns that argument converted to an **int**. + 9. The value of each map entry is the second element of the array in the pipeline—the **double** stratum area. + 10. Don't forget to close the stream (file). + 11. Print out the result, which looks like: [code]`stratumAreas = {1=114.89, 2=207.72, 3=29.77}` +``` +### Build the measurements table and accumulate the measurements into the sample totals + +Now that I have the stratum areas, I can start processing the main body of data—the measurements. I combine the two tasks of building the measurements table and accumulating the measurements into the sample totals since I don't have any interest in the measurement data per se. +``` + + +fileName = "sample_data_for_testing.bsv"; +inputLineStream = Files.lines(Paths.get(fileName)); + + final Map<[Integer][6],Map<[Integer][6],Double>> sampleValues = +    inputLineStream +        .skip(1) +        .map(l -> l.split("\\\|")) +        .collect(                  // (1) +            Collectors.groupingBy(a -> [Integer][6].parseInt(a[0]),     // (2) +                Collectors.groupingBy(b -> [Integer][6].parseInt(b[1]), // (3) +                    Collectors.summingDouble(                      // (4) +                        c -> {                                     // (5) +                            double rm = ([Double][7].parseDouble(c[5]) + +                                [Double][7].parseDouble(c[6]))/4d;      // (6) +                            return rm*rm * [Math][11].PI / 500d;         // (7) +                        }) +                ) +            ) +        ); +inputLineStream.close(); + +[System][8].out.println("sampleValues = " + sampleValues);  // (8) + +``` +Again, a line or two or so at a time: + + 1. The first seven lines are the same in this task and the previous, except the name of this lookup table is **sampleValues**; and it is a **Map** of **Map**s. + 2. The measurement data is grouped into samples (by sample #), which are, in turn, grouped into strata (by stratum #), so I use **Collectors.groupingBy()** at the topmost level [to separate data][12] into strata, with **a[0]** here being the stratum number. + 3. I use **Collectors.groupingBy()** once more to separate data into samples, with **b[1]** here being the sample number. + 4. I use the handy **Collectors.summingDouble()** [to accumulate the data][13] for each measurement within the sample within the stratum. + 5. Again, a Java lambda or anonymous function whose argument **c** is the array of fields, where this lambda has several lines of code that are surrounded by **{** and **}** with a **return** statement just before the **}**. + 6. Calculate the mean crown radius of the measurement. + 7. Calculate the crown area of the measurement as a proportion of the total sample area and return that value as the result of the lambda. + 8. Again, similar to the previous task. The result looks like (with some numbers elided): [code]`sampleValues = {1={1=0.09083231861452731, 66=0.06088002082602869, ... 28=0.0837823490804228}, 2={65=0.14738326403381743, 2=0.16961183847374103, ... 63=0.25083064794883453}, 3={64=0.3306323635177101, 32=0.25911911184680053, ... 30=0.2642668470291564}}` +``` + + + +This output shows the **Map** of **Map**s structure clearly—there are three entries in the top level corresponding to the strata 1, 2, and 3, and each stratum has subentries corresponding to the proportional area of the sample covered by tree crowns. + +#### Accumulate the sample totals into the stratum means and standard errors + +At this point, the task becomes more complex; I need to count the number of samples, sum up the sample values in preparation for calculating the sample mean, and sum up the squares of the sample values in preparation for calculating the standard error of the mean. I may as well incorporate the stratum area into this grouping of data as well, as I'll need it shortly to weigh the stratum results together. + +So the first thing to do is create a class, **StratumAccumulator**, to handle the accumulation and provide the calculation of the interesting results. This class implements **java.util.function.DoubleConsumer**, which can be passed to **collect()** to handle accumulation: + + +``` +class StratumAccumulator implements DoubleConsumer { +    private double ha; +    private int n; +    private double sum; +    private double ssq; +    public StratumAccumulator(double ha) { // (1) +        this.ha = ha; +        this.n = 0; +        this.sum = 0d; +        this.ssq = 0d; +    } +    public void accept(double d) { // (2) +        this.sum += d; +        this.ssq += d*d; +        this.n++; +    } +    public void combine(StratumAccumulator other) { // (3) +        this.sum += other.sum; +        this.ssq += other.ssq; +        this.n += other.n; +    } +    public double getHa() {  // (4) +        return this.ha; +    } +    public int getN() {  // (5) +        return this.n; +    } +    public double getMean() {  // (6) +        return this.n > 0 ? this.sum / this.n : 0d; +    } +    public double getStandardError() {  // (7) +        double mean = this.getMean(); +        double variance = this.n > 1 ? (this.ssq - mean*mean*n)/(this.n - 1) : 0d; +        return this.n > 0 ? [Math][11].sqrt(variance/this.n) : 0d; +    } +} +``` + +Line-by-line: + + 1. The constructor **StratumAccumulator(double ha)** takes an argument, the area of the stratum in hectares, which allows me to merge the stratum area lookup table into instances of this class. + 2. The **accept(double d)** method is used to accumulate the stream of double values, and I use it to: +a. Count the number of values. +b. Sum the values in preparation for computing the sample mean. +c. Sum the squares of the values in preparation for computing the standard error of the mean. + 3. The **combine()** method is used to merge substreams of **StratumAccumulator**s (in case I want to process in parallel). + 4. The getter for the area of the stratum + 5. The getter for the number of samples in the stratum + 6. The getter for the mean sample value in the stratum + 7. The getter for the standard error of the mean in the stratum + + + +Once I have this accumulator, I can use it to accumulate the sample values pertaining to each stratum: + + +``` +final Map<[Integer][6],StratumAccumulator> stratumValues =   // (1) +    sampleValues.entrySet().stream()   // (2) +        .collect(                      // (3) +            Collectors.toMap(          // (4) +                e -> e.getKey(),       // (5) +                e -> e.getValue().entrySet().stream()   // (6) +                    .map([Map.Entry][14]::getValue)           // (7) +                    .collect(          // (8) +                        () -> new StratumAccumulator(stratumAreas.get(e.getKey())),   // (9) +                        StratumAccumulator::accept,     // (10) +                        StratumAccumulator::combine)    // (11) +            ) +        ); +``` + +Line-by-line: + + 1. This time, I'm using the pipeline to build **stratumValues**, which is a **Map<Integer,StratumAccumulator>**, so **stratumValues.get(3)** will return the **StratumAccumulator** instance for stratum 3. + 2. Here, I'm using the **entrySet().stream()** method provided by **Map** to get a stream of (key, value) pairs; recall these are **Map**s of sample values by stratum. + 3. Again, I'm using **collect()** to gather the pipeline results by stratum… + 4. using **Collectors.toMap()** to generate a stream of **Map** entries… + 5. whose keys are the key of the incoming stream (that is, the stratum #)… + 6. and whose values are the Map of sample values, and I again use **entrySet().stream()** to convert to a stream of Map entries, one for each sample. + 7. Using **map()** to get the value of the sample **Map** entry; I'm not interested in the key by this point. + 8. Yet again, using **collect()** to accumulate the sample results into the **StratumAccumulator** instances. + 9. Telling **collect()** how to create a new **StratumAccumulator**—I need to pass the stratum area into the constructor here, so I can't just use **StratumAccumulator::new**. + 10. Telling **collect()** to use the **accept()** method of **StratumAccumulator** to accumulate the stream of sample values. + 11. Telling **collect()** to use the **combine()** method of **StratumAccumulator** to merge **StratumAccumulator** instances. + + + +#### Summarize the stratum figures + +Whew! After all of that, printing out the stratum figures is pretty straightforward: + + +``` +stratumValues.entrySet().stream() +    .forEach(e -> { +        StratumAccumulator sa = e.getValue(); +        int n = sa.getN(); +        double se66 = sa.getStandardError(); +        double t = new TDistribution(n - 1).inverseCumulativeProbability(0.975d); +        [System][8].out.printf("stratum %d n %d mean %g se66 %g t %g se95 %g ha %g\n", +            e.getKey(), n, sa.getMean(), se66, t, se66 * t, sa.getHa()); +    }); +``` + +In the above, once again, I use **entrySet().stream()** to transform the **stratumValues** Map to a stream, and then apply the **forEach()** method to the stream. **ForEach()** is pretty much what it sounds like—a loop! But the business of finding the head of the stream, finding the next element, and checking to see if hits the end is all handled by Java Streams. So, I just get to say what I want to do for each record, which is basically to print it out. + +My code looks a bit more complicated because I declare some local variables to hold some intermediate results that I use more than once—**n**, the number of samples, and **se66**, the standard error of the mean. I also calculate the inverse T value to [convert my standard error of the mean to a 95% confidence interval][15]. + +The result looks like this: + + +``` +stratum 1 n 24 mean 0.0903355 se66 0.0107786 t 2.06866 se95 0.0222973 ha 114.890 +stratum 2 n 38 mean 0.154612 se66 0.00880498 t 2.02619 se95 0.0178406 ha 207.720 +stratum 3 n 11 mean 0.223634 se66 0.0261662 t 2.22814 se95 0.0583020 ha 29.7700 +``` + +#### Accumulate the stratum means and standard errors into the total + +Once again, the task becomes more complex, so I create a class, **TotalAccumulator**, to handle the accumulation and provide the calculation of the interesting results. This class implements **java.util.function.Consumer<T>**, which can be passed to **collect()** to handle accumulation: + + +``` +class TotalAccumulator implements Consumer<StratumAccumulator> { +    private double ha; +    private int n; +    private double sumWtdMeans; +    private double ssqWtdStandardErrors; +    public TotalAccumulator() { +        this.ha = 0d; +        this.n = 0; +        this.sumWtdMeans = 0d; +        this.ssqWtdStandardErrors = 0d; +    } +    public void accept(StratumAccumulator sa) { +        double saha = sa.getHa(); +        double sase = sa.getStandardError(); +        this.ha += saha; +        this.n += sa.getN(); +        this.sumWtdMeans += saha * sa.getMean(); +        this.ssqWtdStandardErrors += saha * saha * sase * sase; +    } +    public void combine(TotalAccumulator other) { +        this.ha += other.ha; +        this.n += other.n; +        this.sumWtdMeans += other.sumWtdMeans; +        this.ssqWtdStandardErrors += other.ssqWtdStandardErrors; +    } +    public double getHa() { +        return this.ha; +    } +    public int getN() { +        return this.n; +    } +    public double getMean() { +        return this.ha > 0 ? this.sumWtdMeans / this.ha : 0d; +    } +    public double getStandardError() { +        return this.ha > 0 ? [Math][11].sqrt(this.ssqWtdStandardErrors) / this.ha : 0; +    } +} +``` + +I'm not going to go into much detail on this, since it's structurally pretty similar to **StratumAccumulator**. Of main interest: + + 1. The constructor takes no arguments, which simplifies its use. + 2. The **accept()** method accumulates instances of **StratumAccumulator**, not **double** values, hence the use of the **Consumer<T>** interface. + 3. As for the calculations, they are assembling a weighted average of the **StratumAccumulator** instances, so they make use of the stratum areas, and the formulas might look a bit strange to anyone who's not used to stratified sampling. + + + +As for actually carrying out the work, it's easy-peasy: + + +``` +final TotalAccumulator totalValues = +    stratumValues.entrySet().stream() +        .map([Map.Entry][14]::getValue) +        .collect(TotalAccumulator::new, TotalAccumulator::accept, TotalAccumulator::combine); +``` + +Same old stuff as before: + + 1. Use **entrySet().stream()** to convert the **stratumValue Map** entries to a stream. + 2. Use **map()** to replace the **Map** entries with their values—the instances of **StratumAccumulator**. + 3. Use **collect()** to apply the **TotalAccumulator** to the instances of **StratumAccumulator**. + + + +#### Summarize the total figures + +Getting the interesting bits out of the **TotalAccumulator** instance is also pretty straightforward: + + +``` +int nT = totalValues.getN(); +double se66T = totalValues.getStandardError(); +double tT = new TDistribution(nT - stratumValues.size()).inverseCumulativeProbability(0.975d); +[System][8].out.printf("total n %d mean %g se66 %g t %g se95 %g ha %g\n", +    nT, totalValues.getMean(), se66T, tT, se66T * tT, totalValues.getHa()); +``` + +Similar to the **StratumAccumulator**, I just call the relevant getters to pick out the number of samples **nT** and the standard error **se66T**. I calculate the T value **tT** (using "n – 3" here since there are three strata), and then I print the result, which looks like this: + + +``` +`total n 73 mean 0.139487 se66 0.00664653 t 1.99444 se95 0.0132561 ha 352.380` +``` + +### In conclusion + +Wow, that looks like a bit of a marathon. It feels like it, too. As is often the case, there is a great deal of information about how to use Java Streams, all illustrated with toy examples, which kind of help, but not really. I found that getting this to work with a real-world (albeit very simple) example was difficult. + +Because I've been working in [Groovy][16] a lot lately, I kept finding myself wanting to accumulate into "maps of maps of maps" rather than creating accumulator classes, but I was never able to pull that off except in the case of totaling up the measurements in the sample. So, I worked with accumulator classes instead of maps of maps, and maps of accumulator classes instead of maps of maps of maps. + +I don't feel like any kind of master of Java Streams at this point, but I do feel I have a pretty solid understanding of **collect()**, which is deeply important, along with various methods to reformat data structures into streams and to reformat stream elements themselves. So yeah, more to learn! + +Speaking of collect(), in the examples I presented above, we can see moving from a very simple use of this fundamental method - using the Collectors.summingDouble() accumulation method - through defining an accumulator class that extends one of the pre-defined interfaces - in this case DoubleConsumer - to defining a full-blown accumulator of our own, used to accumulate the intermediate stratum class. I was tempted - sort of - to work backward and implement fully custom accumulators for the stratum and sample accumulators, but the point of this exercise was to learn more about Java Streams, not to become an expert in one single part of it all. + +What's your experience with Java Streams? Done anything big and complicated yet? Please share it in the comments. + +Optimizing your Java code requires an understanding of how the different elements in Java interact... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/java-streams + +作者:[Chris Hermansen][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/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html +[3]: https://opensource.com/sites/default/files/uploads/landcover.png (Image of land cover in an area) +[4]: https://opensource.com/sites/default/files/uploads/foresters.jpg (Survey team assessing land cover) +[5]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+double +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[9]: https://www.baeldung.com/java-8-collectors +[10]: https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+math +[12]: https://www.baeldung.com/java-groupingby-collector +[13]: http://www.java2s.com/Tutorials/Java/java.util.stream/Collectors/Collectors.summingDouble_ToDoubleFunction_super_T_mapper_.htm +[14]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+map.entry +[15]: https://en.wikipedia.org/wiki/Standard_error +[16]: http://groovy-lang.org/ From 4f381a31514eb438d4e805ba2d11fde24bbbdcd1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 23 Feb 2020 01:13:18 +0800 Subject: [PATCH 042/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200221=20Google?= =?UTF-8?q?=20Cloud=20moves=20to=20aid=20mainframe=20migration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200221 Google Cloud moves to aid mainframe migration.md --- ... Cloud moves to aid mainframe migration.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/talk/20200221 Google Cloud moves to aid mainframe migration.md diff --git a/sources/talk/20200221 Google Cloud moves to aid mainframe migration.md b/sources/talk/20200221 Google Cloud moves to aid mainframe migration.md new file mode 100644 index 0000000000..64b3565109 --- /dev/null +++ b/sources/talk/20200221 Google Cloud moves to aid mainframe migration.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Google Cloud moves to aid mainframe migration) +[#]: via: (https://www.networkworld.com/article/3528451/google-cloud-moves-to-aid-mainframe-migration.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Google Cloud moves to aid mainframe migration +====== +Google bought Cornerstone Technology, whose technology facilitates moving mainframe applications to the cloud. +Thinkstock + +Google Cloud this week bought a mainframe cloud-migration service firm Cornerstone Technology with an eye toward helping Big Iron customers move workloads to the private and public cloud.  + +Google said the Cornerstone technology – found in its [G4 platform][1] – will shape the foundation of its future mainframe-to-Google Cloud offerings and help mainframe customers modernize applications and infrastructure. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“Through the use of automated processes, Cornerstone’s tools can break down your Cobol, PL/1, or Assembler programs into services and then make them cloud native, such as within a managed, containerized environment” wrote Howard Weale, Google’s director, Transformation Practice, in a [blog][3] about the buy. + +“As the industry increasingly builds applications as a set of services, many customers want to break their mainframe monolith programs into either Java monoliths or Java microservices,” Weale stated.  + +Google Cloud’s Cornerstone service will: + + * Develop a migration roadmap where Google will assess a customer’s mainframe environment and create a roadmap to a modern services architecture. + * Convert any language to any other language and any database to any other database to prepare applications for modern environments. + * Automate the migration of workloads to the Google Cloud. + + + +“Easy mainframe migration will go a long way as Google attracts large enterprises to its cloud,” said Matt Eastwood, senior vice president, Enterprise Infrastructure, Cloud, Developers and Alliances, IDC wrote in a statement. + +The Cornerstone move is also part of Google’s effort stay competitive in the face of mainframe-migration offerings from [Amazon Web Services][4], [IBM/RedHat][5] and [Microsoft][6]. + +While the idea of moving legacy applications off the mainframe might indeed be beneficial to a business, Gartner last year warned that such decisions should be taken very deliberately. + +“The value gained by moving applications from the traditional enterprise platform onto the next ‘bright, shiny thing’ rarely provides an improvement in the business process or the company’s bottom line. A great deal of analysis must be performed and each cost accounted for,” Gartner stated in a report entitled *[_Considering Leaving Legacy IBM Platforms? Beware, as Cost Savings May Disappoint, While Risking Quality_][7]. * “Legacy platforms may seem old, outdated and due for replacement. Yet IBM and other vendors are continually integrating open-source tools to appeal to more developers while updating the hardware. Application leaders should reassess the capabilities and quality of these platforms before leaving them.” + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3528451/google-cloud-moves-to-aid-mainframe-migration.html + +作者:[Michael Cooney][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/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.cornerstone.nl/solutions/modernization +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://cloud.google.com/blog/topics/inside-google-cloud/helping-customers-migrate-their-mainframe-workloads-to-google-cloud +[4]: https://aws.amazon.com/blogs/enterprise-strategy/yes-you-should-modernize-your-mainframe-with-the-cloud/ +[5]: https://www.networkworld.com/article/3438542/ibm-z15-mainframe-amps-up-cloud-security-features.html +[6]: https://azure.microsoft.com/en-us/migration/mainframe/ +[7]: https://www.gartner.com/doc/reprints?id=1-6L80XQJ&ct=190429&st=sb +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From c64fa696d6e3089be5a437efc480643147ab1b60 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 23 Feb 2020 01:24:29 +0800 Subject: [PATCH 043/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200221=20Japane?= =?UTF-8?q?se=20firm=20announces=20potential=2080TB=20hard=20drives?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200221 Japanese firm announces potential 80TB hard drives.md --- ...rm announces potential 80TB hard drives.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sources/talk/20200221 Japanese firm announces potential 80TB hard drives.md diff --git a/sources/talk/20200221 Japanese firm announces potential 80TB hard drives.md b/sources/talk/20200221 Japanese firm announces potential 80TB hard drives.md new file mode 100644 index 0000000000..c44e9ded6e --- /dev/null +++ b/sources/talk/20200221 Japanese firm announces potential 80TB hard drives.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Japanese firm announces potential 80TB hard drives) +[#]: via: (https://www.networkworld.com/article/3528211/japanese-firm-announces-potential-80tb-hard-drives.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Japanese firm announces potential 80TB hard drives +====== +Using some very fancy physics for stacking electrons, Showa Denko K.K. plans to quadruple the top end of proposed capacity. +[geralt][1] [(CC0)][2] + +Hard drive makers are staving off obsolescence to solid-state drives (SSDs) by offering capacities that are simply not feasible in an SSD. Seagate and Western Digital are both pushing to release 20TB hard disks in the next few years. A 20TB SSD might be doable but also cost more than a new car. + +But Showa Denko K.K. of Japan has gone one further with the announcement of its next-generation of heat-assisted magnetic recording (HAMR) media for hard drives. The platters use all-new magnetic thin films to maximize their data density, with the goal of eventually enabling 70TB to 80TB hard drives in a 3.5-inch form factor. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +Showa Denko is the world’s largest independent maker of platters for hard drives, selling them to basically anyone left making hard drives not named Seagate and Western Digital. Those two make their own platters and are working on their own next-generation drives for release in the coming years. + +While similar in concept, Seagate and Western Digital have chosen different solutions to the same problem. HAMR, championed by Seagate and Showa, works by temporarily heating the disk material during the write process so data can be written to a much smaller space, thus increasing capacity. + +Western Digital supports a different technology called microwave-assisted magnetic recording (MAMR). It operates under a similar concept as HAMR but uses microwaves instead of heat to alter the drive platter. Seagate hopes to get to 48TB by 2023, while Western Digital is planning on releasing 18TB and 20TB drives this year. + +Heat is never good for a piece of electrical equipment, and Showa Denko’s platters for HAMR HDDs are made of a special composite alloy to tolerate temperature and reduce wear, not to mention increase density. A standard hard disk has a density of about 1.1TB per square inch. Showa’s drive platters have a density of 5-6TB per square inch. + +The question is when they will be for sale, and who will use them. Fellow Japanese electronics giant Toshiba is expected to ship drives with Showa platters later this year. Seagate will be the first American company to adopt HAMR, with 20TB drives scheduled to ship in late 2020. + +[][4] + +Know what’s scary? That still may not be enough. IDC predicts that our global datasphere – the total of all of the digital data we create, consume, or capture – will grow from a total of approximately 40 zettabytes of data in 2019 to 175 zettabytes total by 2025. + +So even with the growth in hard-drive density, the growth in the global data pool – everything from Oracle databases to Instagram photos – may still mean deploying thousands upon thousands of hard drives across data centers. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3528211/japanese-firm-announces-potential-80tb-hard-drives.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://pixabay.com/en/data-data-loss-missing-data-process-2764823/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From c49b180863c10285a8d28ee5fab072ddeb29be16 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 23 Feb 2020 12:00:11 +0800 Subject: [PATCH 044/260] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @HankChow 翻译得很好,对原文融会贯通后用自己的语言来描述很好。不过我认为原文的一些意思有所损失,所以我修改了这些部分,可能修改上不够完善。 --- ... for the YaCy open source search engine.md | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/translated/tech/20200210 Top hacks for the YaCy open source search engine.md b/translated/tech/20200210 Top hacks for the YaCy open source search engine.md index 54c4b2f869..c7255e0425 100644 --- a/translated/tech/20200210 Top hacks for the YaCy open source search engine.md +++ b/translated/tech/20200210 Top hacks for the YaCy open source search engine.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Top hacks for the YaCy open source search engine) @@ -9,70 +9,72 @@ 使用开源搜索引擎 YaCy 的技巧 ====== -> 不想再受制于各种版本的搜索引擎?使用 YaCy 自定义一款吧。 -![Browser of things][1] -在我以前介绍 [YaCy 入门][2]的文章中讲述过 [YaCy][3] 这个点对点peer-to-peer式的搜索引擎是如何安装和使用的。YaCy 最大的一个特点就是可以在本地部署,全球范围内的每一个 YaCy 用户都是构成整个分布式搜索引擎架构的其中一个节点,因此每个用户都可以掌控自己的互联网搜索体验。 +> 无需适应其他人的眼光,而是使用 YaCY 搜索引擎定义你想要的互联网。 -Google 曾经提供过 `google.com/linux` 这样的简便方式以便快速筛选出和 Linux 相关的搜索内容,这个功能受到了很多人的青睐,但 Google 最终还是在 2011 年的时候把它[下线][4]了。 +![](https://img.linux.net.cn/data/attachment/album/202002/23/115822jqkdyjwzdqwdad0y.jpg) + +在我以前介绍 [YaCy 入门][2]的文章中讲述过 [YaCy][3] 这个对等peer-to-peer式的搜索引擎是如何安装和使用的。YaCy 最令人兴奋的一点就是它事实上是一个本地客户端,全球范围内的每一个 YaCy 用户都是构成整个这个分布式搜索引擎架构的一个节点,这意味着每个用户都可以掌控自己的互联网搜索体验。 + +Google 曾经提供过 google.com/linux 这样的主题简便方式以便快速筛选出和 Linux 相关的搜索内容,这个小功能受到了很多人的青睐,但 Google 最终还是在 2011 年的时候把它[下线][4]了。 而 YaCy 则让自定义搜索引擎变得可能。 ### 自定义 YaCy -YaCy 安装好之后,只需要访问 `localhost:8090` 就可以使用了。要开始自定义搜索引擎,只需要点击右上角的“管理Administration”按钮,如果没有找到,需要点击菜单图标打开菜单。 +YaCy 安装好之后,只需要访问 `localhost:8090` 就可以使用了。要自定义搜索引擎,只需要点击右上角的“管理Administration”按钮(它可能隐藏在小屏幕的菜单图标中)。 你可以在管理面板中配置 YaCy 对系统资源的使用策略,以及如何跟其它的 YaCy 客户端进行交互。 ![YaCy profile selector][5] -例如,点击侧栏中的“初步First steps”按钮可以配置备用端口,以及设置 YaCy 对内存和硬盘的使用量;而“监控Monitoring”面板则可以监控 YaCy 的运行状况。大多数功能都只需要在面板上点击几下就可以完成了,例如以下几个常用的功能。 +例如,点击侧栏中的“第一步First steps”按钮可以配置备用端口,以及设置 YaCy 对内存和硬盘的使用量;而“监控Monitoring”面板则可以监控 YaCy 的运行状况。大多数功能都只需要在面板上点击几下就可以完成了,例如以下几个常用的功能。 -### 搜索应用 +### 内网搜索应用 -目前市面上也有不少公司推出了[内网搜索应用][6],而 YaCy 的优势是免费使用。对于能够通过 HTTP、FTP、Samba 等协议访问的文件,YaCy 都可以进行索引,因此无论是作为私人的文件搜索还是企业内部的本地共享文件搜索,YaCy 都可以实现。它可以让内部网络中的用户使用自定义配置的 YaCy 查找共享文件,于此同时保持对内部网络以外的用户不可见。 +目前市面上也有不少公司推出了[内网搜索应用][6],而 YaCy 可以免费为你提供一个。对于能够通过 HTTP、FTP、Samba 等协议访问的文件,YaCy 都可以进行索引,因此无论是作为私人的文件搜索还是企业内部的本地共享文件搜索,YaCy 都可以实现。它可以让内部网络中的用户使用你个人的 YaCy 实例来查找共享文件,于此同时保持对内部网络以外的用户不可见。 ### 网络配置 -YaCy 在默认情况下就对隐私隔离有比较好的支持。点击“用例与账号Use Case & Account”页面顶部的“网络配置Network Configuration”链接,即可进入网络配置面板设置点对点网络。 +YaCy 在默认情况下就支持隐私和隔离。点击“用例与账号Use Case & Account”页面顶部的“网络配置Network Configuration”链接,即可进入网络配置面板设置对等网络。 ![YaCy network configuration][7] ### 爬取站点 -YaCy 点对点的分布式运作方式决定了它对页面的爬取是由用户驱动的。任何一个公司的爬虫都不可能完全访问到整个互联网上的所有页面,对于 YaCy 来说也是这样,一个站点只有在被用户指定爬取的前提下,才会被 YaCy 爬取并进入索引。 +YaCy 的分布式运作方式决定了它对页面的爬取是由用户驱动的。并没有一个大型公司对整个互联网上的所有可访问页面都进行搜索,对于 YaCy 来说也是这样,一个站点只有在被用户指定爬取的前提下,才会被 YaCy 爬取并进入索引。 -YaCy 客户端提供了两种爬取页面的方式:一是自定义爬虫,二是使用 YaCy 推荐的爬虫。 +YaCy 客户端提供了两种爬取页面的方式:你可以手动爬取,并让 YaCy 根据建议去爬取。 ![YaCy advanced crawler][8] -#### 自定义爬虫任务 +#### 手动爬取 -自定义爬虫是指由用户输入指定的网站 URL 并启动 YaCy 的爬虫任务。只需要点击“高级爬虫Advanced Crawler”并输入计划爬取的 URL,然后选择页面底部的“进行远程索引Do Remote indexing”选项,这个选项会让客户端将上面输入的 URL 向互联网广播,接收到广播的其它远程客户端就会开始爬取这些 URL 所指向的页面。 +手动爬取是指由用户输入指定的网站 URL 并启动 YaCy 的爬虫任务。只需要点击“高级爬虫Advanced Crawler”并输入计划爬取的若干 URL,然后选择页面底部的“进行远程索引Do Remote indexing”选项,这个选项会让客户端向互联网广播它要索引的 URL,可选地接受这些请求的客户端可以帮助你爬取这些 URL。 点击页面底部的“开始新爬虫任务Start New Crawl Job”按钮就可以开始进行爬取了,我就是这样对一些常用和有用站点进行爬取和索引的。 爬虫任务启动之后,YaCy 会将这些 URL 对应的页面在本地生成和存储索引。在高级模式下,也就是本地计算机允许 8090 端口流量进出时,全网的 YaCy 用户都可以使用到这一份索引。 -#### 加入爬虫任务 +#### 加入爬虫网络 -尽管 YaCy 用户已经在互联网上爬取了很多页面,但对于全网浩如烟海的页面而言也只是沧海一粟。单个用户所拥有的资源远不及很多大公司的网络爬虫,但大量 YaCy 用户如果联合起来成为一个社区,能产生的力量就大得多了。只要开启了 YaCy 的爬虫请求广播功能,就可以让其它客户端参与进来爬取更多页面。 +尽管一些非常敬业的 YaCy 高级用户已经强迫症般地在互联网上爬取了很多页面,但对于全网浩如烟海的页面而言也只是沧海一粟。单个用户所拥有的资源远不及很多大公司的网络爬虫,但大量 YaCy 用户如果联合起来成为一个社区,能产生的力量就大得多了。只要开启了 YaCy 的爬虫请求广播功能,就可以让其它客户端参与进来爬取更多页面。 -只需要在“高级爬虫Advanced Crawler”面板中点击页面顶部的“远程爬取Remote Crawling”,勾选“加载Load”复选框,就可以让你的客户端接受其它人发来的爬虫任务请求了。 +只需要在“高级爬虫Advanced Crawler”面板中点击页面顶部的“远程爬取Remote Crawling”,勾选“加载Load”旁边的复选框,就可以让你的客户端接受其它人发来的爬虫任务请求了。 ![YaCy remote crawling][9] ### YaCy 监控相关 -YaCy 除了作为一个非常强大的搜索引擎,还提供了很丰富的用户体验。你可以在“监控Monitor”面板中监控 YaCy 客户端的网络运行状况,甚至还可以了解到有多少人从 YaCy 社区中获取到了自己所需要的东西。 +YaCy 除了作为一个非常强大的搜索引擎,还提供了很丰富的主题和用户体验。你可以在“监控Monitor”面板中监控 YaCy 客户端的网络运行状况,甚至还可以了解到有多少人从 YaCy 社区中获取到了自己所需要的东西。 ![YaCy monitoring screen][10] ### 搜索引擎发挥了作用 -你使用 YaCy 的时间越长,就越会思考搜索引擎如何改变自己的视野,因为你对互联网的体验很大一部分来自于你在搜索引擎中一次次简单查询的结果。实际上,当你和不同行业的人交流时,可能会注意到每个人对“互联网”的理解都有所不同。有些人会认为,互联网的搜索引擎中充斥着各种广告和推广,同时也仅仅能从搜索结果中获取到有限的信息。例如,假设有人不断搜索关于关键词 X 的内容,那么大部分商业搜索引擎都会在搜索结果中提高关键词 X 的权重,但与此同时,另一个关键词 Y 的权重则会相对降低,从而让关键词 Y 被淹没在搜索结果当中。 +你使用 YaCy 的时间越长,就越会思考搜索引擎如何改变自己的视野,因为你对互联网的体验很大一部分来自于你在搜索引擎中一次次简单查询的结果。实际上,当你和不同行业的人交流时,可能会注意到每个人对“互联网”的理解都有所不同。有些人会认为,互联网的搜索引擎中充斥着各种广告和推广,同时也仅仅能从搜索结果中获取到有限的信息。例如,假设有人不断搜索关于关键词 X 的内容,那么大部分商业搜索引擎都会在搜索结果中提高关键词 X 的权重,但与此同时,另一个关键词 Y 的权重则会相对降低,从而让关键词 Y 被淹没在搜索结果当中,即使这样对完成特定任务更好。 -就像在现实生活中一样,走出舒适圈会让你看到一个更广阔的世界。尝试使用 YaCy,看看你会不会有所收获。 +就像在现实生活中一样,走出虚拟的世界视野会让你看到一个更广阔的世界。尝试使用 YaCy,看看你发现了什么。 -------------------------------------------------------------------------------- @@ -81,14 +83,14 @@ via: https://opensource.com/article/20/2/yacy-search-engine-hacks 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/seth [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_desktop_website_checklist_metrics.png?itok=OKKbl1UR (Browser of things) -[2]: https://opensource.com/article/20/2/open-source-search-engine +[2]: https://linux.cn/article-11905-1.html [3]: https://yacy.net/ [4]: https://www.linuxquestions.org/questions/linux-news-59/is-there-no-more-linux-google-884306/ [5]: https://opensource.com/sites/default/files/uploads/yacy-profiles.jpg (YaCy profile selector) From c63de0476f87c0df5cefc4a100e4040a91de2cfb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 23 Feb 2020 12:00:38 +0800 Subject: [PATCH 045/260] PUB @HankChow https://linux.cn/article-11919-1.html --- ...200210 Top hacks for the YaCy open source search engine.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200210 Top hacks for the YaCy open source search engine.md (99%) diff --git a/translated/tech/20200210 Top hacks for the YaCy open source search engine.md b/published/20200210 Top hacks for the YaCy open source search engine.md similarity index 99% rename from translated/tech/20200210 Top hacks for the YaCy open source search engine.md rename to published/20200210 Top hacks for the YaCy open source search engine.md index c7255e0425..aaa71c4f0e 100644 --- a/translated/tech/20200210 Top hacks for the YaCy open source search engine.md +++ b/published/20200210 Top hacks for the YaCy open source search engine.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11919-1.html) [#]: subject: (Top hacks for the YaCy open source search engine) [#]: via: (https://opensource.com/article/20/2/yacy-search-engine-hacks) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 69cf5a15ef05120cb08ac736107042bda9a7a5a5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 23 Feb 2020 12:45:41 +0800 Subject: [PATCH 046/260] PRF @geekpi --- ...ux system configuration with Bash tools.md | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/translated/tech/20200122 Screenshot your Linux system configuration with Bash tools.md b/translated/tech/20200122 Screenshot your Linux system configuration with Bash tools.md index f7e2bb10aa..50c1b30d0e 100644 --- a/translated/tech/20200122 Screenshot your Linux system configuration with Bash tools.md +++ b/translated/tech/20200122 Screenshot your Linux system configuration with Bash tools.md @@ -9,74 +9,72 @@ 使用 Bash 工具截屏 Linux 系统配置 ====== -使用 ScreenFetch 和 Neofetch 与其他人轻松分享 Linux 环境。 -![metrics and data shown on a computer screen][1] -你可能有很多原因想要与他人分享 Linux 配置。你可能正在寻求帮助来对系统上的问题进行故障排除,或者你对所创建的环境感到非常自豪,因此想向其他开源爱好者展示。 +> 使用 ScreenFetch 和 Neofetch 与其他人轻松分享你的 Linux 环境。 -你可以在 Bash 提示符下使用 **cat /proc/cpuinfo** 或 **lscpu** 命令获取某些信息。但是,如果你想共享更多详细信息,例如你的操作系统、内核、运行时间、shell 环境,屏幕分辨率等,那么可以选择两个很棒的工具:screenFetch 和 Neofetch。 +![](https://img.linux.net.cn/data/attachment/album/202002/23/124525yiiqs18ll736oro8.jpg) -### ScreenFetch +你可能有很多原因想要与他人分享你的 Linux 配置。你可能正在寻求帮助来对系统上的问题进行故障排除,或者你对所创建的环境感到非常自豪,因此想向其他开源爱好者展示。 -[ScreenFetch][2] 是 Bash 命令行程序,它可以产生非常漂亮的系统配置和运行时间的截图。这是方便的与它人共享系统配置的方法。 +你可以在 Bash 提示符下使用 `cat /proc/cpuinfo` 或 `lscpu` 命令获取某些信息。但是,如果你想共享更多详细信息,例如你的操作系统、内核、运行时间、shell 环境,屏幕分辨率等,那么可以选择两个很棒的工具:screenFetch 和 Neofetch。 + +### screenFetch + +[screenFetch][2] 是 Bash 命令行程序,它可以产生非常漂亮的系统配置和运行时间的截图。这是方便的与它人共享系统配置的方法。 在许多 Linux 发行版上安装 screenFetch 很简单。 在 Fedora 上,输入: - ``` -`$ sudo dnf install screenfetch` +$ sudo dnf install screenfetch ``` 在 Ubuntu 上,输入: - ``` -`$ sudo apt install screenfetch` +$ sudo apt install screenfetch ``` 对于其他操作系统,包括 FreeBSD、MacOS 等,请查阅 screenFetch 的 wiki [安装页面][3]。安装 screenFetch 后,它可以生成详细而彩色的截图,如下所示: ![screenFetch][4] -ScreenFetch 还提供各种命令行选项来调整你的结果。例如, **screenfetch -v** 返回详细输出,逐行显示每个选项以及上面的显示。 +ScreenFetch 还提供各种命令行选项来调整你的结果。例如,`screenfetch -v` 返回详细输出,逐行显示每个选项以及上面的显示。 -**screenfetch -n** 在显示系统信息时消除了操作系统图标。 +`screenfetch -n` 在显示系统信息时消除了操作系统图标。 ![screenfetch -n option][5] -其他选项包括 **screenfetch -N**,它去除所有输出的颜色。**screenfetch -t**,它根据终端的大小截断输出。**screenFetch -E**,它可抑制错误输出。 +其他选项包括 `screenfetch -N`,它去除所有输出的颜色。`screenfetch -t`,它根据终端的大小截断输出。`screenFetch -E`,它可抑制错误输出。 -请检查手册页来了解其他选项。ScreenFetch 在 GPLv3 许可证下的开源,你可以在它的 [GitHub 仓库][6]中了解有关该项目的更多信息。 +请检查手册页来了解其他选项。screenFetch 在 GPLv3 许可证下的开源,你可以在它的 [GitHub 仓库][6]中了解有关该项目的更多信息。 ### Neofetch [Neofetch][7] 是创建系统信息截图的另一个工具。它是用 Bash 3.2 编写的,在 [MIT 许可证][8]下开源。 -根据项目网站,“Neofetch 支持近 150 种不同的操作系统。从 Linux 到 Windows,一直到 Minix、AIX 和 Haiku 等更晦涩的操作系统。” +根据项目网站所述,“Neofetch 支持近 150 种不同的操作系统。从 Linux 到 Windows,一直到 Minix、AIX 和 Haiku 等更晦涩的操作系统。” ![Neofetch][9] -该项目维护了一个 wiki,其中包含用于各种发行版和操作系统的出色的[安装文档] [10]。 +该项目维护了一个 wiki,其中包含用于各种发行版和操作系统的出色的[安装文档][10]。 如果你使用的是 Fedora、RHEL 或 CentOS,那么可以在 Bash 提示符下使用以下命令安装 Neofetch: - ``` -`$ sudo dnf install neofetch` +$ sudo dnf install neofetch ``` 在 Ubuntu 17.10 及更高版本上,你可以使用: - ``` -`$ sudo apt install neofetch` +$ sudo apt install neofetch ``` -首次运行时,Neofetch 将 **~/.config/neofetch/config.conf** 文件写入主目录(**.config/config.conf**),它让你可以[自定义和控制] [ 11] Neofetch 输出的各个方面。例如,你可以配置 Neofetch 使用图像、ASCII 文件、你选择的壁纸,或者完全不使用。config.conf 文件还让与它人分享配置变得容易。 +首次运行时,Neofetch 将 `~/.config/neofetch/config.conf` 文件写入主目录(`.config/config.conf`),它让你可以[自定义和控制][11] Neofetch 输出的各个方面。例如,你可以配置 Neofetch 使用图像、ASCII 文件、你选择的壁纸,或者完全不使用。config.conf 文件还让与它人分享配置变得容易。 -如果 Neofetch 不支持你的操作系统或不提供所需选项,请在项目的 [GitHub 仓库] [12]中打开一个问题。 +如果 Neofetch 不支持你的操作系统或不提供所需选项,请在项目的 [GitHub 仓库][12]中打开一个问题。 ### 总结 @@ -89,7 +87,7 @@ via: https://opensource.com/article/20/1/screenfetch-neofetch 作者:[Don Watkins][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 a84b8b565eccc9414d96226e04a0ce3bda43bbf5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 23 Feb 2020 12:46:38 +0800 Subject: [PATCH 047/260] PUB @geekpi https://linux.cn/article-11920-1.html --- ...nshot your Linux system configuration with Bash tools.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200122 Screenshot your Linux system configuration with Bash tools.md (98%) diff --git a/translated/tech/20200122 Screenshot your Linux system configuration with Bash tools.md b/published/20200122 Screenshot your Linux system configuration with Bash tools.md similarity index 98% rename from translated/tech/20200122 Screenshot your Linux system configuration with Bash tools.md rename to published/20200122 Screenshot your Linux system configuration with Bash tools.md index 50c1b30d0e..e8507162f9 100644 --- a/translated/tech/20200122 Screenshot your Linux system configuration with Bash tools.md +++ b/published/20200122 Screenshot your Linux system configuration with Bash tools.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11920-1.html) [#]: subject: (Screenshot your Linux system configuration with Bash tools) [#]: via: (https://opensource.com/article/20/1/screenfetch-neofetch) [#]: author: (Don Watkins https://opensource.com/users/don-watkins) From 25361b4f30ce68f88f1c4d493d7c9867911233f6 Mon Sep 17 00:00:00 2001 From: darksun Date: Sun, 23 Feb 2020 20:48:46 +0800 Subject: [PATCH 048/260] translate done: 20190114 Some Advice for How to Make Emacs Tetris Harder.md --- ...ice for How to Make Emacs Tetris Harder.md | 157 ----------------- ...ice for How to Make Emacs Tetris Harder.md | 161 ++++++++++++++++++ 2 files changed, 161 insertions(+), 157 deletions(-) delete mode 100644 sources/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md create mode 100644 translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md diff --git a/sources/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md b/sources/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md deleted file mode 100644 index 829dd3703f..0000000000 --- a/sources/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md +++ /dev/null @@ -1,157 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Some Advice for How to Make Emacs Tetris Harder) -[#]: via: (https://nickdrozd.github.io/2019/01/14/tetris.html) -[#]: author: (nickdrozd https://nickdrozd.github.io) - -Some Advice for How to Make Emacs Tetris Harder -====== - -Did you know that Emacs comes bundled with an implementation of Tetris? Just hit M-x tetris and there it is: - -![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-normal.png) - -This is often mentioned by Emacs advocates in text editor discussions. “Yeah, but can that other editor run Tetris?” I wonder, is that supposed to convince anyone that Emacs is superior? Like, why would anyone care that they could play games in their text editor? “Yeah, but can that other vacuum play mp3s?” - -That said, Tetris is always fun. Like everything in Emacs, the source code is open for easy inspection and modifcation, so it’s possible to make it even more fun. And by more fun, I mean harder. - -One of the simplest ways to make the game harder is to get rid of the next-block preview. No more sitting that S/Z block in a precarious position knowing that you can fill in the space with the next piece – you have to chance it and hope for the best. Here’s what it looks like with no preview (as you can see, without the preview I made some choices that turned out to have dire consequences): - -![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-no-preview.png) - -The preview box is set with a function called tetris-draw-next-shape[1][2]: - -``` -(defun tetris-draw-next-shape () - (dotimes (x 4) - (dotimes (y 4) - (gamegrid-set-cell (+ tetris-next-x x) - (+ tetris-next-y y) - tetris-blank))) - (dotimes (i 4) - (let ((tetris-shape tetris-next-shape) - (tetris-rot 0)) - (gamegrid-set-cell (+ tetris-next-x - (aref (tetris-get-shape-cell i) 0)) - (+ tetris-next-y - (aref (tetris-get-shape-cell i) 1)) - tetris-shape)))) -``` - -First, we’ll introduce a flag to allow configuring next-preview[2][3]: - -``` -(defvar tetris-preview-next-shape nil - "When non-nil, show the next block the preview box.") -``` - -Now the question is, how can we make tetris-draw-next-shape obey this flag? The obvious way would be to redefine it: - -``` -(defun tetris-draw-next-shape () - (when tetris-preview-next-shape - ;; existing tetris-draw-next-shape logic - )) -``` - -This is not an ideal solution. There will be two definitions of the same function floating around, which is confusing, and we’ll have to maintain our modified definition in case the upstream version changes. - -A better approach is to use advice. Emacs advice is like a Python decorator, but even more flexible, since advice can be added to a function from anywhere. This means that we can modify the function without disturbing the original source file at all. - -There are a lot of different ways to use Emacs advice ([check the manual][4]), but for now we’ll just stick with the advice-add function with the :around flag. The advising function takes the original function as an argument, and it might or might not execute it. In this case, we’ll say that the original should be executed only if the preview flag is non-nil: - -``` -(defun tetris-maybe-draw-next-shape (tetris-draw-next-shape) - (when tetris-preview-next-shape - (funcall tetris-draw-next-shape))) - -(advice-add 'tetris-draw-next-shape :around #'tetris-maybe-draw-next-shape) -``` - -This code will modify the behavior of tetris-draw-next-shape, but it can be stored in your config files, safely away from the actual Tetris code. - -Getting rid of the preview box is a simple change. A more drastic change is to make it so that blocks randomly stop in the air: - -![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-air.png) - -In that picture, the red I and green T pieces are not falling, they’re set in place. This can make the game almost unplayably hard, but it’s easy to implement. - -As before, we’ll first define a flag: - -``` -(defvar tetris-stop-midair t - "If non-nil, pieces will sometimes stop in the air.") -``` - -Now, the way Emacs Tetris works is something like this. The active piece has x- and y-coordinates. On each clock tick, the y-coordinate is incremented (the piece moves down one row), and then a check is made for collisions. If a collision is detected, the piece is backed out (its y-coordinate is decremented) and set in place. In order to make a piece stop in the air, all we have to do is hack the detection function, tetris-test-shape. - -It doesn’t matter what this function does internally – what matters is that it’s a function of no arguments that returns a boolean value. We need it to return true whenever it normally would (otherwise we risk weird collisions) but also at other times. I’m sure there are a variety of ways this could be done, but here is what I came up with: - -``` -(defun tetris-test-shape-random (tetris-test-shape) - (or (and - tetris-stop-midair - ;; Don't stop on the first shape. - (< 1 tetris-n-shapes ) - ;; Stop every INTERVAL pieces. - (let ((interval 7)) - (zerop (mod tetris-n-shapes interval))) - ;; Don't stop too early (it makes the game unplayable). - (let ((upper-limit 8)) - (< upper-limit tetris-pos-y)) - ;; Don't stop at the same place every time. - (zerop (mod (random 7) 10))) - (funcall tetris-test-shape))) - -(advice-add 'tetris-test-shape :around #'tetris-test-shape-random) -``` - -The hardcoded parameters here were chosen to make the game harder but still playable. I was drunk on an airplane when I decided on them though, so they might need some further tweaking. - -By the way, according to my tetris-scores file, my top score is - -``` -01389 Wed Dec 5 15:32:19 2018 -``` - -The scores in that file are listed up to five digits by default, so that doesn’t seem very good. - -Exercises for the reader - -1. Using advice, modify Emacs Tetris so that it flashes the messsage “OH SHIT” under the scoreboard every time the block moves down. Make the size of the message proportional to the height of the block stack (when there are no blocks, the message should be small or nonexistent, and when the highest block is close to the ceiling, the message should be large). - -2. The version of tetris-test-shape-random given here has every seventh piece stop midair. A player could potentially figure out the interval and use it to their advantage. Modify it to make the interval random in some reasonable range (say, every five to ten pieces). - -3. For a different take on advising Tetris, try out [autotetris-mode][1]. - -4. Come up with an interesting way to mess with the piece-rotation mechanics and then implement it with advice. - -Footnotes -============================================================ - -[1][5] Emacs has just one big global namespace, so function and variable names are typically prefixed with their package name in order to avoid collisions. - -[2][6] A lot of people will tell you that you shouldn’t use an existing namespace prefix and that you should reserve a namespace prefix for anything you define yourself, e.g. my/tetris-preview-next-shape. This is ugly and usually pointless, so I don’t do it. - --------------------------------------------------------------------------------- - -via: https://nickdrozd.github.io/2019/01/14/tetris.html - -作者:[nickdrozd][a] -选题:[lujun9972][b] -译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://nickdrozd.github.io -[b]: https://github.com/lujun9972 -[1]: https://nullprogram.com/blog/2014/10/19/ -[2]: https://nickdrozd.github.io/2019/01/14/tetris.html#fn.1 -[3]: https://nickdrozd.github.io/2019/01/14/tetris.html#fn.2 -[4]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html -[5]: https://nickdrozd.github.io/2019/01/14/tetris.html#fnr.1 -[6]: https://nickdrozd.github.io/2019/01/14/tetris.html#fnr.2 diff --git a/translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md b/translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md new file mode 100644 index 0000000000..81d107ec69 --- /dev/null +++ b/translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Some Advice for How to Make Emacs Tetris Harder) +[#]: via: (https://nickdrozd.github.io/2019/01/14/tetris.html) +[#]: author: (nickdrozd https://nickdrozd.github.io) + +让 Emacs 俄罗斯方块变得更难的一些建议 (Advice) +====== + +你知道吗,**Emacs** 与 **俄罗斯方块** 的实现捆绑在一起了?只需要输入 `M-x tetris` 就行了。 + +![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-normal.png) + +在文本编辑器讨论中,Emacs 倡导者经常提到这一点。“没错,但是那个编辑器能运行俄罗斯方块吗?” +我很好奇,这会让大家相信 Emacs 更优秀吗?比如,为什么有人会关心他们是否可以在文本编辑器中玩游戏呢?“是的,但是那台吸尘器能播放 mp3 吗?” + +有人说,俄罗斯方块总是很有趣的。像 Emacs 中的所有东西一样,它的源代码是开放的,易于检查和修改,因此 **我们可以使它变得更加有趣**。所谓更多的乐趣,我意思是更难。 + +让游戏变得更困难的一个最简单的方法就是“不要下一个块预览”。你无法再在知道下一个块会填满空间的情况下有意地将 S/Z 块放在一个危险的位置——你必须碰碰运气,希望出现最好的情况。 +下面是没有预览的情况(如你所见,没有预览,我做出的某些选择带来了“可怕的后果”): + +![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-no-preview.png) + +预览框由一个名为 `tetris-draw-next-shape` 的函数设置: + +``` +(defun tetris-draw-next-shape () + (dotimes (x 4) + (dotimes (y 4) + (gamegrid-set-cell (+ tetris-next-x x) + (+ tetris-next-y y) + tetris-blank))) + (dotimes (i 4) + (let ((tetris-shape tetris-next-shape) + (tetris-rot 0)) + (gamegrid-set-cell (+ tetris-next-x + (aref (tetris-get-shape-cell i) 0)) + (+ tetris-next-y + (aref (tetris-get-shape-cell i) 1)) + tetris-shape)))) +``` + +首先,我们引入一个标志,决定是否允许显示下一个预览块: + +``` +(defvar tetris-preview-next-shape nil + "When non-nil, show the next block the preview box.") +``` + +现在的问题是,我们如何才能让 `tetris-draw-next-shape` 遵从这个标志?最明显的方法是重新定义它: + +``` +(defun tetris-draw-next-shape () + (when tetris-preview-next-shape + ;; existing tetris-draw-next-shape logic + )) +``` + +但这不是理想的解决方案。同一个函数有两个定义,这很容易引起混淆,如果上游版本发生变化,我们必须维护修改后的定义。 + +一个更好的方法是使用 **advice**。Emacs 的 advice 类似于 **Python 装饰器**,但是更加灵活,因为 advice 可以从任何地方添加到函数中。这意味着我们可以修改函数而不影响原始的源文件。 + +有很多不同的方法使用 Emacs advice([ 查看手册 ][4]),但是这里我们只使用 `advice-add` 函数和 `:around` 标志。advise 函数将原始函数作为参数,原始函数可能执行也可能不执行。我们这里,我们让原始函数只有在预览标志是非空的情况下才能执行: + +``` +(defun tetris-maybe-draw-next-shape (tetris-draw-next-shape) + (when tetris-preview-next-shape + (funcall tetris-draw-next-shape))) + +(advice-add 'tetris-draw-next-shape :around #'tetris-maybe-draw-next-shape) +``` + +这段代码将修改 `tetris-draw-next-shape` 的行为,而且它可以存储在配置文件中,与实际的俄罗斯方块代码分离。 + +去掉预览框是一个简单的改变。一个更激烈的变化是,**让块随机停止在空中**: + +![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-air.png) + +本图中,红色的 I 和绿色的 T 部分没有掉下来,它们被固定下来了。这会让游戏变得 **及其难玩**,但却很容易实现。 + +和前面一样,我们首先定义一个标志: + +``` +(defvar tetris-stop-midair t + "If non-nil, pieces will sometimes stop in the air.") +``` + +目前,**Emacs 俄罗斯方块的工作方式** 类似这样子:活动部件有 x 和 y 坐标。在每个时钟滴答声中,y 坐标递增(块向下移动一行),然后检查是否有与现存的块重叠。 +如果检测到重叠,则将该块回退(其 y 坐标递减)并设置该活动块到位。为了让一个块在半空中停下来,我们所要做的就是破解检测函数 `tetris-test-shape`。 + +**这个函数内部做什么并不重要** —— 重要的是它是一个返回布尔值的无参数函数。我们需要它在正常情况下返回布尔值 true( 否则我们将出现奇怪的重叠情况),但在其他时候也需要它返回 true。我相信有很多方法可以做到这一点,以下是我的方法的: + +``` +(defun tetris-test-shape-random (tetris-test-shape) + (or (and + tetris-stop-midair + ;; Don't stop on the first shape. + (< 1 tetris-n-shapes ) + ;; Stop every INTERVAL pieces. + (let ((interval 7)) + (zerop (mod tetris-n-shapes interval))) + ;; Don't stop too early (it makes the game unplayable). + (let ((upper-limit 8)) + (< upper-limit tetris-pos-y)) + ;; Don't stop at the same place every time. + (zerop (mod (random 7) 10))) + (funcall tetris-test-shape))) + +(advice-add 'tetris-test-shape :around #'tetris-test-shape-random) +``` + +这里的硬编码参数使游戏变得更困难,但仍然可玩。当时我在飞机上喝醉了,所以它们可能需要进一步调整。 + +顺便说一下,根据我的 `tetris-scores` 文件,我的 **最高分** 是 + +``` +01389 Wed Dec 5 15:32:19 2018 +``` + +该文件中列出的分数默认最多为五位数,因此这个分数看起来不是很好。 + +**给读者的练习** + +1。使用 advice 修改 Emacs 俄罗斯方块,使得每当方块下移动时就闪烁显示讯息 “OH SHIT”。消息的大小与块堆的高度成比例(当没有块时,消息应该很小的或不存在的,当最高块接近天花板时,消息应该很大)。 + +2。在这里给出的 `tetris-test-shape-random` 版本中,每隔七格就有一个半空中停止。一个玩家有可能能计算出时间间隔,并利用它来获得优势。修改它,使间隔随机在一些合理的范围内(例如,每 5 到 10 格)。 + +3。另一个对使用 Tetris 使用 advise 的场景,你可以试试 [`autotetris-mode`][1]。 + +4。想出一个有趣的方法来打乱块的旋转机制,然后使用 advice 来实现它。 + + +附注 +============================================================ + +[1][5] Emacs 只有一个巨大的全局命名空间,因此函数和变量名一般以包名做前缀以避免冲突。 + +[2][6] 很多人会说你不应该使用已有的命名空间前缀而且应该将自己定义的所有东西都放在一个预留的命名空间中,比如像这样 `my/tetris-preview-next-shape`,然而这样很难看而且没什么意义,因此我不会这么干。 + +-------------------------------------------------------------------------------- + +via: https://nickdrozd.github.io/2019/01/14/tetris.html + +作者:[nickdrozd][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://nickdrozd.github.io +[b]: https://github.com/lujun9972 +[1]: https://nullprogram.com/blog/2014/10/19/ +[2]: https://nickdrozd.github.io/2019/01/14/tetris.html#fn.1 +[3]: https://nickdrozd.github.io/2019/01/14/tetris.html#fn.2 +[4]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html +[5]: https://nickdrozd.github.io/2019/01/14/tetris.html#fnr.1 +[6]: https://nickdrozd.github.io/2019/01/14/tetris.html#fnr.2 From ce2f820078dac5191a4262ab7e42e7ed2fa96d39 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 23 Feb 2020 21:57:49 +0800 Subject: [PATCH 049/260] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qianmingtian 这篇用心了! --- .../20200217 How to install Vim plugins.md | 75 +++++++++---------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/translated/tech/20200217 How to install Vim plugins.md b/translated/tech/20200217 How to install Vim plugins.md index b21da86139..ebf48b1c4f 100644 --- a/translated/tech/20200217 How to install Vim plugins.md +++ b/translated/tech/20200217 How to install Vim plugins.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (qianmingtian) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to install Vim plugins) @@ -10,74 +10,73 @@ 如何安装 Vim 插件 ====== -无论你是手动安装还是通过包管理器安装,插件都可以帮你为你的工作流中打造一个完美的 Vim 。 -![Team checklist and to dos][1] +> 无论你是手动安装还是通过包管理器安装,插件都可以帮助你在工作流中打造一个完美的 Vim 。 -虽然 [Vim][2] 是快速且高效的,但在默认情况下,它仅仅只是一个文本编辑器。至少,这就是没有插件的情况 Vim 应当具备的样子,插件构建在 Vim 之上,并添加额外的功能,使 Vim 不仅仅是一个输入文本的窗口。有了合适的插件组合,你可以控制你的生活,形成你自己独特的 Vim 体验。你可以[自定义你的主题][3],你可以添加语法高亮,代码 linting ,版本跟踪器等等。 +![](https://img.linux.net.cn/data/attachment/album/202002/23/215719kwhqzwwj1ezoen6o.jpg) + +虽然 [Vim][2] 是快速且高效的,但在默认情况下,它仅仅只是一个文本编辑器。至少,这就是没有插件的情况 Vim 应当具备的样子,插件构建在 Vim 之上,并添加额外的功能,使 Vim 不仅仅是一个输入文本的窗口。有了合适的插件组合,你可以控制你的生活,形成你自己独特的 Vim 体验。你可以[自定义你的主题][3],你可以添加语法高亮,代码 linting,版本跟踪器等等。 ### 怎么安装 Vim 插件 -Vim 可以通过插件进行扩展,但很长一段时间以来,并没有官方的安装方式去安装这些插件。从 Vim 8 开始,有一个关于插件如何安装和加载的结构。你可能会在网上或项目自述文件中遇到旧的说明,但只要你运行 Vim 8 或更高版本,你应该根据 Vim 的[官方插件安装方法][4]安装或使用 Vim 包管理器。您可以使用包管理器,无论你运行的是什么版本(包括比 8.x 更老的版本),这使得安装过程比您自己维护更新更容易。 +Vim 可以通过插件进行扩展,但很长一段时间以来,并没有官方的安装方式去安装这些插件。从 Vim 8 开始,有一个关于插件如何安装和加载的结构。你可能会在网上或项目自述文件中遇到旧的说明,但只要你运行 Vim 8 或更高版本,你应该根据 Vim 的[官方插件安装方法][4]安装或使用 Vim 包管理器。你可以使用包管理器,无论你运行的是什么版本(包括比 8.x 更老的版本),这使得安装过程比你自己维护更新更容易。 手动和自动安装方法都值得了解,所以请继续阅读以了解这两种方法。 -### 手动安装插件( Vim 8 及以上版本) +### 手动安装插件(Vim 8 及以上版本) -Vim 包是一个包含一个或多个插件的目录。默认情况下,你的 Vim 设置包含在 **~/.vim** 中,这是 vim 在启动时寻找插件的地方。(下面的示例使用了通用名称 **vendor** 来表示插件是从一个不是你的实体获得的。) +所谓的 “Vim 包”是一个包含一个或多个插件的目录。默认情况下,你的 Vim 设置包含在 `~/.vim` 中,这是 Vim 在启动时寻找插件的地方。(下面的示例使用了通用名称 `vendor` 来表示插件是从其它地方获得的。) -当你启动 Vim 时,它首先处理你的 **.vimrc**文件,然后扫描 **~/.vim** 中的所有目录查找包含在 **pack/*/start** 中的插件。 +当你启动 Vim 时,它首先处理你的 `.vimrc`文件,然后扫描 `~/.vim` 中的所有目录,查找包含在 `pack/*/start` 中的插件。 -默认情况下,你的 **~/.vim** 目录(如果你有一个)没有这样的文件结构,所以设置为: +默认情况下,你的 `~/.vim` 目录(如果你有的话)中没有这样的文件结构,所以设置为: ``` -`$ mkdir -p ~/.vim/pack/vendor/start` +$ mkdir -p ~/.vim/pack/vendor/start ``` -现在,你可以将 Vim 插件放在 **~/.vim/pack/vendor/start** 中,它们会在你启动 Vim 时自动加载。 - -例如,尝试安装一下 [NERDTree][5] ,一个基于文本的 Vim 文件管理器。首先,使用 Git 克隆 NERDTree 存储库的快照: +现在,你可以将 Vim 插件放在 `~/.vim/pack/vendor/start` 中,它们会在你启动 Vim 时自动加载。 +例如,尝试安装一下 [NERDTree][5],这是一个基于文本的 Vim 文件管理器。首先,使用 Git 克隆 NERDTree 存储库的快照: ``` $ git clone --depth 1 \ -  \ +  https://github.com/preservim/nerdtree.git \   ~/.vim/pack/vendor/start/nerdtree ``` -启动 Vim 或者 gvim ,然后键入如下命令: - +启动 Vim 或者 gvim,然后键入如下命令: ``` -`:NERDTree` +:NERDTree ``` Vim 窗口左侧将打开一个文件树。 ![NERDTree plugin][6] -如果你不想每次启动 Vim 时自动加载插件,你可以在 **~/.vim/pack/vendor** 中创建 **opt** 文件夹: +如果你不想让一个插件每次启动 Vim 时都自动加载,你可以在 `~/.vim/pack/vendor` 中创建 `opt` 文件夹: ``` -`$ mkdir ~/.vim/pack/vendor/opt` +$ mkdir ~/.vim/pack/vendor/opt ``` -任何安装到 **opt** 的插件都可被 Vim 使用,但是只有当你使用 **packadd** 命令将它们添加到一个会话中时,它们才会被加载到内存中。例如,一个虚构的叫 foo 的插件: +任何安装到 `opt` 的插件都可被 Vim 使用,但是只有当你使用 `packadd` 命令将它们添加到一个会话中时,它们才会被加载到内存中。例如,一个虚构的叫 foo 的插件: ``` -`:packadd foo` +:packadd foo ``` -Vim 官方建议每个插件项目在 **~/.Vim /pack** 中有自己的目录。例如,如果你要安装 NERDTree 插件和假想的 foo 插件,你需要创建这样的目录结构: +Vim 官方建议每个插件项目在 `~/.Vim/pack` 中创建自己的目录。例如,如果你要安装 NERDTree 插件和假想的 foo 插件,你需要创建这样的目录结构: ``` $ mkdir -p ~/.vim/pack/NERDTree/start/ $ git clone --depth 1 \ -  \ -  ~/.vim/pack/NERDTree/start/NERDTree + https://github.com/preservim/nerdtree.git \ + ~/.vim/pack/NERDTree/start/NERDTree $ mkdir -p ~/.vim/pack/foo/start/ $ git clone --depth 1 \ -  \ -  ~/.vim/pack/foo/start/foo + https://notabug.org/foo/foo.git \ + ~/.vim/pack/foo/start/foo ``` 这样做是否方便取决于你。 @@ -88,14 +87,14 @@ $ git clone --depth 1 \ #### 使用 vim-plug 安装插件 -安装 vim-plug ,以便它在启动时自动加载: +安装 vim-plug,以便它在启动时自动加载: ``` $ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ -  +  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim ``` -创建一个 **~/.vimrc** 文件(如果你还没有文件),然后输入以下文本: +创建一个 `~/.vimrc` 文件(如果你还没有这个文件),然后输入以下文本: ``` call plug#begin() @@ -103,38 +102,38 @@ Plug 'preservim/NERDTree' call plug#end() ``` -每次要安装插件时,都必须在 **plug#begin()** 和 **plug#end()** 之间输入插件的名称和位置(上面以 NERDTree 文件管理器为例。)。如果你所需的插件未托管在 GitHub 上,你可以提供完整的 URL ,而不仅仅是 GitHub 用户名和项目 ID 。你甚至可以在 **~/.vim** 目录之外“安装”本地插件。 +每次要安装插件时,都必须在 `plug#begin()` 和 `plug#end()` 之间输入插件的名称和位置(上面以 NERDTree 文件管理器为例)。如果你所需的插件未托管在 GitHub 上,你可以提供完整的 URL,而不仅仅是 GitHub 的用户名和项目 ID。你甚至可以在 `~/.vim` 目录之外“安装”本地插件。 -最后,启动 Vim 并提示 vim-plug 安装 **~/.vimrc** 中列出的插件: +最后,启动 Vim 并提示 vim-plug 安装 `~/.vimrc` 中列出的插件: ``` -`:PlugInstall` +:PlugInstall ``` 等待插件下载。 #### 通过 vim-plug 更新插件 -与手动安装过程相比,编辑 **~/.vimrc** 并使用命令来进行安装可能看起来并没有多省事,但是 vim-plug 的真正优势在更新。更新所有安装的插件,使用这个 Vim 命令: +与手动安装过程相比,编辑 `~/.vimrc` 并使用命令来进行安装可能看起来并没有多省事,但是 vim-plug 的真正优势在更新。更新所有安装的插件,使用这个 Vim 命令: ``` -`:PlugUpdate` +:PlugUpdate ``` 如果你不想更新所有的插件,你可以通过添加插件的名字来更新任何插件: ``` -`:PlugUpdate NERDTree` +:PlugUpdate NERDTree ``` #### 恢复插件 -vim-plug 的另一个优点是它的导出和恢复功能。 Vim 用户都知道,正是插件的缘故,通常每个用户使用 Vim 的工作方式都是独一无二的。一旦你安装和配置了正确的插件组合,你最不想要的就是再也找不到它们。 +vim-plug 的另一个优点是它的导出和恢复功能。Vim 用户都知道,正是插件的缘故,通常每个用户使用 Vim 的工作方式都是独一无二的。一旦你安装和配置了正确的插件组合,你最不想要的局面就是再也找不到它们。 Vim-plug 有这个命令来生成一个脚本来恢复所有当前的插件: ``` -`:PlugSnapshot ~/vim-plug.list` +:PlugSnapshot ~/vim-plug.list ``` vim-plug 还有许多其他的功能,所以请参考它的[项目页面][7]以获得完整的文档。 @@ -151,7 +150,7 @@ via: https://opensource.com/article/20/2/how-install-vim-plugins 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[qianmingtian][c] -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3842f6d12347623771c5f4f807e346222647ac06 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 23 Feb 2020 21:58:21 +0800 Subject: [PATCH 050/260] PUB @qianmingtian https://linux.cn/article-11923-1.html --- .../tech => published}/20200217 How to install Vim plugins.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200217 How to install Vim plugins.md (99%) diff --git a/translated/tech/20200217 How to install Vim plugins.md b/published/20200217 How to install Vim plugins.md similarity index 99% rename from translated/tech/20200217 How to install Vim plugins.md rename to published/20200217 How to install Vim plugins.md index ebf48b1c4f..f3ce601e53 100644 --- a/translated/tech/20200217 How to install Vim plugins.md +++ b/published/20200217 How to install Vim plugins.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qianmingtian) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11923-1.html) [#]: subject: (How to install Vim plugins) [#]: via: (https://opensource.com/article/20/2/how-install-vim-plugins) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From e42379b313a5d3823c4a0a1da31547714114f8fa Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 24 Feb 2020 00:55:54 +0800 Subject: [PATCH 051/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200224=2017=20C?= =?UTF-8?q?ool=20Arduino=20Project=20Ideas=20for=20DIY=20Enthusiasts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200224 17 Cool Arduino Project Ideas for DIY Enthusiasts.md --- ...duino Project Ideas for DIY Enthusiasts.md | 272 ++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 sources/tech/20200224 17 Cool Arduino Project Ideas for DIY Enthusiasts.md diff --git a/sources/tech/20200224 17 Cool Arduino Project Ideas for DIY Enthusiasts.md b/sources/tech/20200224 17 Cool Arduino Project Ideas for DIY Enthusiasts.md new file mode 100644 index 0000000000..2cfe9c1872 --- /dev/null +++ b/sources/tech/20200224 17 Cool Arduino Project Ideas for DIY Enthusiasts.md @@ -0,0 +1,272 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (17 Cool Arduino Project Ideas for DIY Enthusiasts) +[#]: via: (https://itsfoss.com/cool-arduino-projects/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +17 Cool Arduino Project Ideas for DIY Enthusiasts +====== + +[Arduino][1] is an open-source electronics platform that combines both open source software and hardware to let people make interactive projects with ease. You can get Arduino-compatible [single board computers][2] and use them to make something useful. + +In addition to the hardware, you will also need to know the [Arduino language][3] to use the [Arduino IDE][4] to successfully create something. + +You can code using the web editor or use the Arduino IDE offline. Nevertheless, you can always refer to the [official resources][5] available to learn about Arduino. + +Considering that you know the essentials, I will be mentioning some of the best (or interesting) Arduino projects. You can try to make them for yourself or modify them to come up with something of your own. + +### Interesting Arduino project ideas for beginners, experts, everyone + +![][6] + +The following projects need a variety of additional hardware – so make sure to check out the official link to the projects (_originally featured on the [official Arduino Project Hub][7]_) to learn more about them. + +Also, it is worth noting that they aren’t particularly in any ranking order – so feel free to try what sounds best to you. + +#### 1\. LED Controller + +Looking for simple Arduino projects? Here’s one for you. + +One of the easiest projects that let you control LED lights. Yes, you do not have to opt for expensive LED products just to decorate your room (or for any other use-case), you can simply make an LED controller and customize it to use it however you want. + +It requires using the [Arduino UNO board][8] and a couple more things (which also includes an Android phone). You can learn more about it in the link to the project below. + +[LED Controller][9] + +#### 2\. Hot Glue LED Matrix Lamp + +![][10] + +Another Arduino LED project for you. Since we are talking about using LEDs to decorate, you can also make an LED lamp that looks beautiful. + +For this, you might want to make sure that you have a 3D printer. Next, you need an LED strip and **Arduino Nano R3** as the primary materials. + +Once you’ve printed the case and assembled the lamp section, all you need to do is to add the glue sticks and figure out the wiring. It does sound very simple to mention – you can learn more about it on the official Arduino project feature site. + +[LED Matrix Lamp][11] + +#### 3\. Arduino Mega Chess + +![][12] + +Want to have a personal digital chessboard? Why not? + +You’ll need a TFT LCD touch screen display and an [Arduino Mega 2560][13] board as the primary materials. If you have a 3D printer, you can create a pretty case for it and make changes accordingly. + +Take a look at the original project for inspiration. + +[Arduino Mega Chess][14] + +#### 4\. Enough Already: Mute My TV + +A very interesting project. I wouldn’t argue the usefulness of it – but if you’re annoyed by certain celebrities (or personalities) on TV, you can simply mute their voice whenever they’re about to speak something on TV. + +Technically, it was tested with the old tech back then (when you didn’t really stream anything). You can watch the video above to get an idea and try to recreate it or simply head to the link to read more about it. + +[Mute My TV][15] + +#### 5\. Robot Arm with Controller + +![][16] + +If you want to do something with the help of your robot and still have manual control over it, the robot arm with a controller is one of the most useful Arduino projects. It uses the [Arduino UNO board][8] if you’re wondering. + +You will have a robot arm -for which you can make a case using the 3D printer to enhance its usage and you can use it for a variety of use-cases. For instance, to clean the carbage using the robot arm or anything similar where you don’t want to directly intervene. + +[Robotic Arm With Controller][17] + +#### 6\. Make Musical Instrument Using Arduino + +I’ve seen a variety of musical instruments made using Arduino. You can explore the Internet if you want something different than this. + +You would need a [Pi supply flick charge][18] and an **Arduino UNO** to make it happen. It is indeed a cool Arduino project where you get to simply tap and your hand waves will be converted to music. Also, it isn’t tough to make this – so you should have a lot of fun making this. + +[Musical Instrument using Arduino][19] + +#### 7\. Pet Trainer: The MuttMentor + +An Arduino-based device that assists you to help train your pet – sounds exciting! + +For this, they’re using the [Arduino Nano 33 BLE Sense][20] while utilizing TensorFlow to train a small neural network for all the common actions that your pet does. Accordingly, the buzzer will offer a reinforcing notification when your pet obeys your command. + +This can have wide applications when tweaked as per your requirements. Check out the details below. + +[The MuttMentor][21] + +#### 8\. Basic Earthquake Detector + +Normally, you depend on the government officials to announce/inform about the earthquake stats (or the warning for it). + +But with Arduino boards, you can simply build a basic earthquake detector and have transparent results for yourself without depending on the authorities. Click on the button below to know about the relevant details to help make it. + +[Basic Earthquake Detector][22] + +#### 9\. Security Access Using RFID Reader + +![][23] + +As the project describes – “_RFID tagging is an ID system that uses small radio frequency identification_ “. + +So, in this project, you will be making an RFID reader using Arduino while pairing it with an [Adafruit NFC card][24] for security access. Check out the full details using the button below and let me know how it works for you. + +[Security Access using RFID reader][25] + +#### 10\. Smoke Detection using MQ-2 Gas Sensor + +![][26] + +This could be potentially one of the best Arduino projects out there. You don’t need to spend a lot of money to equip smoke detectors for your home, you can manage with a DIY solution to some extent. + +Of course, unless you want a complex failsafe set up along with your smoke detector, a basic inexpensive solution should do the trick. In either case, you can also find other applications for the smoke detector. + +[Smoke Detector][27] + +#### 11\. Arduino Based Amazon Echo using 1Sheeld + +![][28] + +In case you didn’t know [1Sheeld][29] basically replaces the need for an add-on Arduino board. You just need a smartphone and add Arduino shields to it so that you can do a lot of things with it. + +Using 5 such shields, the original creator of this project made himself a DIY Amazon Echo. You can find all the relevant details, schematics, and code to make it happen. + +[DIY Amazon Echo][30] + +#### 12\. Audio Spectrum Visualizer + +![][31] + +Just want to make something cool? Well, here’s an idea for an audio spectrum visualizer. + +For this, you will need an Arduino Nano R3 and an LED display as primary materials to get started with. You can tweak the display as required. You can connect it with your headphone output or simply a line-out amplifier. + +Easily one of the cheapest Arduino projects that you can try for fun. + +[Audio Spectrum Visualizer][32] + +#### 13\. Motion Following Motorized Camera + +![][33] + +Up for a challenge? If you are – this will be one of the coolest Arduino Projects in our list. + +Basically, this is meant to replace your home security camera which is limited to an angle of video recording. You can turn the same camera into a motorized camera that follows the motion. + +So, whenever it detects a movement, it will change its angle to try to follow the object. You can read more about it to find out how to make it. + +[Motion Following Motorized Camera][34] + +#### 14\. Water Quality Monitoring System + +![][35] + +If you’re concerned about your health in connection to the water you drink, you can try making this. + +It requires an Arduino UNO and the water quality sensors as the primary materials. To be honest, a useful Arduino project to go for. You can find everything you need to make this in the link below. + +[Water Quality Monitoring System][36] + +#### 15\. Punch Activated Arm Flamethrower + +I would be very cautious about this – but seriously, one of the best (and coolest) Arduino projects I’ve ever come across. + +Of course, this counts as a fun project to try out to see what bigger projects you can pull off using Arduino and here it is. In the project, he originally used the [SparkFun Arduino Pro Mini 328][37] along with an accelerometer as the primary materials. + +[Punch Activated Flamethrower][38] + +#### 16\. Polar Drawing Machine + +![][39] + +This isn’t any ordinary plotter machine that you might’ve seen people creating using Arduino boards. + +With this, you can draw some cool vector graphics images or bitmap. It might sound like bit of overkill but then it could also be fun to do something like this. + +This could be a tricky project, so you can refer to the details on the link to go through it thoroughly. + +[Polar Drawing Machine][40] + +#### 17\. Home Automation + +Technically, this is just a broad project idea because you can utilize the Arduino board to automate almost anything you want at your home. + +Just like I mentioned, you can go for a security access device, maybe create something that automatically waters the plants or simply make an alarm system. + +Countless possibilities of what you can do to automate things at your home. For reference, I’ve linked to an interesting home automation project below. + +[Home Automation][41] + +#### Bonus: Robot Cat (OpenCat) + +![][42] + +A programmable robotic cat for AI-enhanced services and STEM education. In this project, both Arduino and Raspberry Pi boards have been utilized. + +You can also look at the [Raspberry Pi alternatives][2] if you want. This project needs a lot of work, so you would want to invest a good amount of time to make it work. + +[OpenCat][43] + +**Wrapping Up** + +With the help of Arduino boards (coupled with other sensors and materials), you can do a lot of projects with ease. Some of the projects that I’ve listed above are suitable for beginners and some are not. Feel free to take your time to analyze what you need and the cost of the project before proceeding. + +Did I miss listing an interesting Arduino project that deserves the mention here? Let me know your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cool-arduino-projects/ + +作者:[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.arduino.cc/ +[2]: https://itsfoss.com/raspberry-pi-alternatives/ +[3]: https://www.arduino.cc/reference/en/ +[4]: https://www.arduino.cc/en/main/software +[5]: https://www.arduino.cc/en/Guide/HomePage +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/arduino-project-ideas.jpg?ssl=1 +[7]: https://create.arduino.cc/projecthub +[8]: https://store.arduino.cc/usa/arduino-uno-rev3 +[9]: https://create.arduino.cc/projecthub/mayooghgirish/arduino-bluetooth-basic-tutorial-d8b737?ref=platform&ref_id=424_trending___&offset=89 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/led-matrix-lamp.jpg?ssl=1 +[11]: https://create.arduino.cc/projecthub/john-bradnam/hot-glue-led-matrix-lamp-42322b?ref=platform&ref_id=424_trending___&offset=42 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/arduino-chess-board.jpg?ssl=1 +[13]: https://store.arduino.cc/usa/mega-2560-r3 +[14]: https://create.arduino.cc/projecthub/Sergey_Urusov/arduino-mega-chess-d54383?ref=platform&ref_id=424_trending___&offset=95 +[15]: https://makezine.com/2011/08/16/enough-already-the-arduino-solution-to-overexposed-celebs/ +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/robotic-arm-controller.jpg?ssl=1 +[17]: https://create.arduino.cc/projecthub/H0meMadeGarbage/robot-arm-with-controller-2038df?ref=platform&ref_id=424_trending___&offset=13 +[18]: https://uk.pi-supply.com/products/flick-hat-3d-tracking-gesture-hat-raspberry-pi +[19]: https://create.arduino.cc/projecthub/lanmiLab/make-musical-instrument-using-arduino-and-flick-large-e2890b?ref=platform&ref_id=424_trending___&offset=24 +[20]: https://store.arduino.cc/usa/nano-33-ble-sense +[21]: https://create.arduino.cc/projecthub/whatsupdog/the-muttmentor-9d9753?ref=platform&ref_id=424_trending___&offset=44 +[22]: https://www.instructables.com/id/Basic-Arduino-Earthquake-Detector/ +[23]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/security-access-arduino.jpg?ssl=1 +[24]: https://www.adafruit.com/product/359 +[25]: https://create.arduino.cc/projecthub/Aritro/security-access-using-rfid-reader-f7c746?ref=platform&ref_id=424_trending___&offset=85 +[26]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/smoke-detection-arduino.jpg?ssl=1 +[27]: https://create.arduino.cc/projecthub/Aritro/smoke-detection-using-mq-2-gas-sensor-79c54a?ref=platform&ref_id=424_trending___&offset=89 +[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/diy-amazon-echo.jpg?ssl=1 +[29]: https://1sheeld.com/ +[30]: https://create.arduino.cc/projecthub/ahmedismail3115/arduino-based-amazon-echo-using-1sheeld-84fa6f?ref=platform&ref_id=424_trending___&offset=91 +[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/audio-spectrum-visualizer.jpg?ssl=1 +[32]: https://create.arduino.cc/projecthub/Shajeeb/32-band-audio-spectrum-visualizer-analyzer-902f51?ref=platform&ref_id=424_trending___&offset=87 +[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/motion-following-camera.jpg?ssl=1 +[34]: https://create.arduino.cc/projecthub/lindsi8784/motion-following-motorized-camera-base-61afeb?ref=platform&ref_id=424_trending___&offset=86 +[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/water-quality-monitoring.jpg?ssl=1 +[36]: https://create.arduino.cc/projecthub/chanhj/water-quality-monitoring-system-ddcb43?ref=platform&ref_id=424_trending___&offset=93 +[37]: https://www.sparkfun.com/products/11113 +[38]: https://create.arduino.cc/projecthub/Advanced/punch-activated-arm-flamethrowers-real-firebending-95bb80 +[39]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/polar-drawing-machine.jpg?ssl=1 +[40]: https://create.arduino.cc/projecthub/ArduinoFT/polar-drawing-machine-f7a05c?ref=search&ref_id=drawing&offset=2 +[41]: https://create.arduino.cc/projecthub/ahmedel-hinidy2014/home-management-system-control-your-home-from-a-website-076846?ref=search&ref_id=home%20automation&offset=4 +[42]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/opencat.jpg?ssl=1 +[43]: https://create.arduino.cc/projecthub/petoi/opencat-845129?ref=platform&ref_id=424_popular___&offset=8 From 065112e562fb5c16bcdde4b06b17e4bca0b2fd19 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 24 Feb 2020 00:56:31 +0800 Subject: [PATCH 052/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200224=20Discus?= =?UTF-8?q?sing=20Past,=20Present=20and=20Future=20of=20FreeBSD=20Project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200224 Discussing Past, Present and Future of FreeBSD Project.md --- ..., Present and Future of FreeBSD Project.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20200224 Discussing Past, Present and Future of FreeBSD Project.md diff --git a/sources/tech/20200224 Discussing Past, Present and Future of FreeBSD Project.md b/sources/tech/20200224 Discussing Past, Present and Future of FreeBSD Project.md new file mode 100644 index 0000000000..4a02a80f20 --- /dev/null +++ b/sources/tech/20200224 Discussing Past, Present and Future of FreeBSD Project.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Discussing Past, Present and Future of FreeBSD Project) +[#]: via: (https://itsfoss.com/freebsd-interview-deb-goodkin/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Discussing Past, Present and Future of FreeBSD Project +====== + +[FreeBSD][1] is one of the most popular BSD distributions. It is used on desktop, servers and embedded devices for more than two decades. + +We talked to Deb Goodkin, executive director, [FreeBSD Foundation][2] and discussed the past, present and future of FreeBSD project. + +![][3] + +**It’s FOSS: FreeBSD has been in the scene for more than 25 years. How do you see the journey of FreeBSD? ** + +Over the years, we’ve seen a lot of innovation happening on and with FreeBSD. When the Foundation came into play 20 years ago, we were able to step in and help accelerate changes in the operating system. Over the years, we’ve increased our marketing support, to provide more advocacy and educational material, and to increase the awareness and use of FreeBSD. + +In addition, we’ve increased our staff of software developers to allow us to quickly step in to fix bugs, review patches, implement workarounds to hardware issues, and implement new features and functionality. We have also increased the number of development projects we are funding to improve various areas of FreeBSD. + +The history of stability and reliability, along with all the improvements and growth with FreeBSD, is making it a compelling choice for companies, universities, and individuals. + +**It’s FOSS: We know that Netflix uses FreeBSD extensively. What other companies or groups rely on FreeBSD? How do they contribute to BSD/FreeBSD (if they do at all)?** + +Sony’s Playstation 4 uses a modified version of FreeBSD as their operating system, Apple with their MacOS and iOS, NetApp in their ONTAP product, Juniper Networks  in [JunOS][4], Trivago in their backend infrastructure, University of Cambridge in security research including the Capability Hardware Enhanced RISC Instruction (CHERI) project, University of Notre Dame in their Engineering Department, Groupon in their datacenter, LA Times in their data center, as well as, other notable companies like Panasonic, and Nintendo. + +I listed a variety of organizations to highlight the different FreeBSD use cases. Companies like [Netflix support FreeBSD][5] by supporting the Project financially, as well as, by upstreaming their code. Some of the companies, like Sony, take advantage of the BSD license and don’t give back at all.  + +![Deb Goodkin And Friend Promoting FreeBSD At Oscon][6] + +**It’s FOSS: Linux is ruling the servers and cloud computing. It seems that BSD is lagging in that field?** + +I wouldn’t characterize it as lagging, per se. Linux distributions do have a much higher market share than FreeBSD, but our strength falls in those two markets. FreeBSD does extremely well in these markets, because it provides a consistent and reliable foundation, and tends to just work. Known for having long term API stability, the user will integrate once and upgrade on their terms as both FreeBSD and their product evolves.  + +**It’s FOSS: Do you see the emergence of Linux as a threat to BSD? ** + +Sure, [there are so many Linux distributions][7] already, and most of them are supported by for profit companies. In fact, companies like Intel have many Linux developers on staff, so Linux is easily supported on their hardware. + +However, thanks to the continuing education efforts and as our market share continues to grow, more developers will be available to support companies’ various FreeBSD use cases.  + +**It’s FOSS: Let’s talk about desktop. Recently, the devs of Project Trident announced that they were moving away from FreeBSD as a base. They said that they made this decision because FreeBSD is slow to review updates and support for new hardware. For example, the most recent version of Telegram on FreeBSD is 9 releases behind the version available on Linux. How would you respond to their comments?** + +There are quite a few FreeBSD distros for the desktop, with various focuses. The latest, is [FuryBSD][8], which coincidentally was started by iXsystems employees, but is independent of iXsystems, just like Project Trident is. In addition to FuryBSD, you may want to check out [NomadBSD][9] and [MidnightBSD][10]. + +Regarding supporting new hardware, we’ve stepped up our efforts to get FreeBSD working on more popular newer laptops. For example, the Foundation recently purchased a couple of the latest generation Lenovo X1 Carbon laptops and sponsored work to make sure that peripherals are supported out-of-the-box. + +**It’s FOSS: Why should a desktop user consider choosing FreeBSD?** + +There are many reasons people should consider using FreeBSD on their desktop! Just to highlight a few, it has rock solid stability; high performance; supports [ZFS][11] to protect your data; a community that is friendly, helpful, and approachable; excellent documentation to easily find answers; over 30,000 open source software packages that are easy to install, allowing you to easily set up your environment without a lot of extras, and that includes many choices of popular GUIs, and it follows the POLA philosophy ([Principle of Least Astonishment][12]) which means, don’t break things that work and upgrades are generally painless (even across major releases).  + +**It’s FOSS: Are there any plans to make it easier to install FreeBSD as a desktop system? The current focus seems to be on servers.** + +The Foundation is supporting efforts to make sure FreeBSD works on the latest hardware and peripherals that appear in desktop systems, and will continue to support making FreeBSD easy to deploy, monitor, and configure to provide a great toolbox for building a desktop on top of it. That allows others to take as much or as little of FreeBSD to build a desktop version to produce a specific user experience they desire. + +Like I mentioned above, there are other FreeBSD distributions that have taken these FreeBSD components and created their own desktop versions. + +**It’s FOSS: What are your plans/roadmap for FreeBSD in the coming years?** + +The FreeBSD Foundation’s purpose is to support the FreeBSD Project. While we’re an entirely separate entity, we work closely with the Core Team and the community to help move the Project forward. The Foundation identifies key areas we should support in the coming years, based on input from users and what we are seeing in the industry.  + +In 2019, we embarked on an even broader spectrum advocacy project to recruit new members throughout the world, while raising awareness about the benefits of learning FreeBSD. We are funding development projects including WiFi improvements, supporting OpenJDK, ZFS RAID-Z expansion, security, toolchain, performance improvements, and other features to keep FreeBSD innovative. + +The FreeBSD Foundation will continue to host workshops and expand the amount of training opportunities and materials we provide. Finally, the [BSD Certification program][13] recently launched through Linux Professional Institute with greater availability.  + +**It’s FOSS: How can we bring more people to the BSD hold?** + +We need more PR for FreeBSD and get more tech journalists like yourself to write about FreeBSD. We also need more trainings and classes that include FreeBSD in universities, trainings/workshops at technical conferences, more FreeBSD contributors giving talks at those conferences, more technical journalists, as well as, users writing about FreeBSD, and finally we need case studies from companies and organizations successfully using FreeBSD. It all takes having more resources! We’re working on all of the above.  + +**It’s FOSS: Any message you would like to convey to our readers?** + +Readers should consider getting involved with the largest and oldest democratically run open source project! + +Whether you want to learn systems programming or how an operating system works, the small size of the operating system makes it a great platform to learn from. The size of the Project makes it easier for anyone to make a notable contribution, and there is a strong mentorship culture to support new contributors. + +Being a democratically run project, allows your voice to be heard and work in the areas you are interested in. I hope your readers will go to [freebsd.org][1] and try it out themselves. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/freebsd-interview-deb-goodkin/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.freebsd.org/ +[2]: https://www.freebsdfoundation.org/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/deb-goodkin-interview.png?ssl=1 +[4]: https://www.juniper.net/us/en/products-services/nos/junos/ +[5]: https://itsfoss.com/netflix-freebsd-cdn/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/FreeBSDFoundation_Deb_Goodkin_and_friend_promoting_FreeBSD_at_OSCON.jpg?ssl=1 +[7]: https://itsfoss.com/best-linux-distributions/ +[8]: https://itsfoss.com/furybsd/ +[9]: https://itsfoss.com/nomadbsd/ +[10]: https://itsfoss.com/midnightbsd-1-0-release/ +[11]: https://itsfoss.com/what-is-zfs/ +[12]: https://en.wikipedia.org/wiki/Principle_of_least_astonishment +[13]: https://www.lpi.org/our-certifications/bsd-overview From 706496e649a22df4a8c85e5c4b5e3a92bfc2543e Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 24 Feb 2020 08:26:36 +0800 Subject: [PATCH 053/260] translated --- ...to Install Latest Git Version on Ubuntu.md | 135 ------------------ ...to Install Latest Git Version on Ubuntu.md | 130 +++++++++++++++++ 2 files changed, 130 insertions(+), 135 deletions(-) delete mode 100644 sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md create mode 100644 translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md diff --git a/sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md b/sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md deleted file mode 100644 index 55ab72d565..0000000000 --- a/sources/tech/20200219 How to Install Latest Git Version on Ubuntu.md +++ /dev/null @@ -1,135 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install Latest Git Version on Ubuntu) -[#]: via: (https://itsfoss.com/install-git-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Install Latest Git Version on Ubuntu -====== - -Installing Git on Ubuntu is very easy. It is available in the [main repository of Ubuntu][1] and you can install it [using the apt command][2] like this: - -``` -sudo apt install git -``` - -Easy? Isn’t it? - -There is only a slight little problem (which might not be a problem at all) and that is the version of [Git][3] it installs. - -On an LTS system, the software stability is of upmost importance this is why Ubuntu 18.04 and other distributions often provide older but stable version of a software that is well tested with the distribution release. - -This is why when you check the Git version, you’ll see that it installs a version which is older than the [current Git version available on Git project’s website][4]: - -``` -[email protected]:~$ git --version -git version 2.17.1 -``` - -At the time of writing this tutorial, the version available on its website is 2.25. So how do you install the latest Git on Ubuntu then? - -### Install latest Git on Ubuntu-based Linux distributions - -![][5] - -One way would be to [install from source code][6]. That cool, old school method is not everyone’s cup of tea. Thankfully, there is a [PPA available from Ubuntu Git Maintainers team][7] that you can use to easily install the latest stable Git version. - -``` -sudo add-apt-repository ppa:git-core/ppa -sudo apt update -sudo apt install git -``` - -Even if you had installed Git using apt previously, it will get updated to the latest stable version. - -``` -[email protected]:~$ git --version -git version 2.25.0 -``` - -The beauty of [using PPA][8] is that if there is a new stable version of Git released, you’ll get it with the system updates. [Just update Ubuntu][9] to get the latest Git stable version. - -Trivia - -Did you know that Git version control system was created by none other than [Linux creator Linus Torvalds][10]? - -### Configure Git [Recommended for developers] - -If you have installed Git for development purposes, you’ll soon start cloning repos, make your changes and commit your change. - -If you try to commit your code, you may see a ‘Please tell me who you are’ error like this: - -``` -[email protected]:~/compress-pdf$ git commit -m "update readme" - -*** Please tell me who you are. - -Run - - git config --global user.email "[email protected]" - git config --global user.name "Your Name" - -to set your account's default identity. -Omit --global to set the identity only in this repository. - -fatal: unable to auto-detect email address (got '[email protected](none)') -``` - -This is because you haven’t configured Git with your personal information which is mandatory. - -As the error already hints, you can set up global Git configuration like this: - -``` -git config --global user.name "Your Name" -git config --global user.email "[email protected]" -``` - -You can check the Git configuration with this command: - -``` -git config --list -``` - -It should show an output like this: - -``` -[email protected] -user.name=abhishek -``` - -This configuration is stored in ~/.gitconfig file. You may also change it manually to change the configuration. - -* * * - -**In the end…** - -I hope this quick little tutorial helped you to install Git on Ubuntu. With the PPA, you easily get the latest Git version. - -If you have any questions or suggestions, please feel free to ask in the comment section. A quick ‘thank you’ is also welcomed :) - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-git-ubuntu/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/ubuntu-repositories/ -[2]: https://itsfoss.com/apt-command-guide/ -[3]: https://git-scm.com/ -[4]: https://git-scm.com/downloads -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/install_git_ubuntu.png?ssl=1 -[6]: https://itsfoss.com/install-software-from-source-code/ -[7]: https://launchpad.net/~git-core/+archive/ubuntu/ppa -[8]: https://itsfoss.com/ppa-guide/ -[9]: https://itsfoss.com/update-ubuntu/ -[10]: https://itsfoss.com/linus-torvalds-facts/ diff --git a/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md b/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md new file mode 100644 index 0000000000..b6b240dadc --- /dev/null +++ b/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Latest Git Version on Ubuntu) +[#]: via: (https://itsfoss.com/install-git-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 上安装最新版本的 Git +====== + +在 Ubuntu 上安装 Git 非常容易。它存在于 [Ubuntu 的主仓库][1]中,你可以像这样[使用 apt 命令][2]安装它: + +``` +sudo apt install git +``` + +很简单?是不是? + +只有一点点小问题(这可能根本不是问题),就是它安装的 [Git][3] 版本。 + +在 LTS 系统上,软件稳定性至关重要,这就是为什么 Ubuntu 18.04 和其他发行版经常提供较旧但稳定的软件版本的原因,它们都经过发行版的良好测试。 + +这就是为什么当你检查 Git 版本时,会看到安装的版本会比 [Git 网站上当前最新 Git 版本][4]旧: + +``` +[email protected]:~$ git --version +git version 2.17.1 +``` + +在编写本教程时,网站上提供的版本为 2.25。那么,如何在 Ubuntu 上安装最新的 Git? + +### 在基于 Ubuntu 的 Linux 发行版上安装最新的 Git + +![][5] + +一种方法是[从源代码安装][6]。这种很酷又老派的方法不适合所有人。值得庆幸的是,Ubuntu Git 维护团队提供了 [PPA][7],莫可以使用它轻松地安装最新的稳定 Git 版本。 + +``` +sudo add-apt-repository ppa:git-core/ppa +sudo apt update +sudo apt install git +``` + +即使你以前使用 apt 安装了 Git,它也将更新为最新的稳定版本。 + +``` +[email protected]:~$ git --version +git version 2.25.0 +``` + +[使用PPA][8] 的好处在于,如果发布了新的 Git 稳定版本,那么就可以通过系统更新获得它。[仅更新 Ubuntu][9]来获取最新的 Git 稳定版本。 + +### 配置Git (推荐给开发者) + +如果你出于开发目的安装了 Git,你会很快开始克隆仓库,进行更改并提交更改。 + +如果你尝试提交代码,那么你可能会看到 “Please tell me who you are” 这样的错误: + +``` +[email protected]:~/compress-pdf$ git commit -m "update readme" + +*** Please tell me who you are. + +Run + + git config --global user.email "[email protected]" + git config --global user.name "Your Name" + +to set your account's default identity. +Omit --global to set the identity only in this repository. + +fatal: unable to auto-detect email address (got '[email protected](none)') +``` + +这是因为你还没配置必要的个人信息。 + +正如错误已经暗示的那样,你可以像这样设置全局 Git 配置: + +``` +git config --global user.name "Your Name" +git config --global user.email "[email protected]" +``` + +你可以使用以下命令检查 Git 配置: + +``` +git config --list +``` + +它应该显示如下输出: + +``` +[email protected] +user.name=abhishek +``` + +配置保存在 \~/.gitconfig 中。你可以手动修改配置。 + +* * * + +**结尾** + +我希望这个小教程可以帮助你在 Ubuntu 上安装 Git。使用 PPA,你可以轻松获得最新的 Git 版本。 + +如果你有任何疑问或建议,请随时在评论部分提问。也欢迎直接写“谢谢” :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-git-ubuntu/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-repositories/ +[2]: https://itsfoss.com/apt-command-guide/ +[3]: https://git-scm.com/ +[4]: https://git-scm.com/downloads +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/install_git_ubuntu.png?ssl=1 +[6]: https://itsfoss.com/install-software-from-source-code/ +[7]: https://launchpad.net/~git-core/+archive/ubuntu/ppa +[8]: https://itsfoss.com/ppa-guide/ +[9]: https://itsfoss.com/update-ubuntu/ \ No newline at end of file From 13ec002065a277ca03d839c3369fa1ca3a05e789 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Feb 2020 09:53:15 +0800 Subject: [PATCH 054/260] Rename sources/tech/20200224 Discussing Past, Present and Future of FreeBSD Project.md to sources/talk/20200224 Discussing Past, Present and Future of FreeBSD Project.md --- ...0224 Discussing Past, Present and Future of FreeBSD Project.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200224 Discussing Past, Present and Future of FreeBSD Project.md (100%) diff --git a/sources/tech/20200224 Discussing Past, Present and Future of FreeBSD Project.md b/sources/talk/20200224 Discussing Past, Present and Future of FreeBSD Project.md similarity index 100% rename from sources/tech/20200224 Discussing Past, Present and Future of FreeBSD Project.md rename to sources/talk/20200224 Discussing Past, Present and Future of FreeBSD Project.md From a90371bf99cb94f4b5a3521f7f4545ec60868af6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 24 Feb 2020 10:43:08 +0800 Subject: [PATCH 055/260] PRF @Morisun029 --- ...13 Why developers like to code at night.md | 62 +++++++++---------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/translated/tech/20200213 Why developers like to code at night.md b/translated/tech/20200213 Why developers like to code at night.md index 9221f322cf..6756b79234 100644 --- a/translated/tech/20200213 Why developers like to code at night.md +++ b/translated/tech/20200213 Why developers like to code at night.md @@ -1,92 +1,87 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Why developers like to code at night) [#]: via: (https://opensource.com/article/20/2/why-developers-code-night) [#]: author: (Matt Shealy https://opensource.com/users/mshealy) -开发人员为什么喜欢在晚上编码 +程序员为什么喜欢在晚上编码 ====== -对许多开源程序员来说,夜间工作计划是创造力和生产力来源的关键。 -![Person programming on a laptop on a building][1] +> 对许多开源程序员来说,夜间的工作计划是创造力和生产力来源的关键。 + +![](https://img.linux.net.cn/data/attachment/album/202002/24/104251b2hxch46h45c8zwd.jpg) 如果你问大多数开发人员更喜欢在什么时候工作,大部人会说他们最高效的时间在晚上。这对于那些在工作之余为开源项目做贡献的人来说更是如此(尽管如此,希望在他们的健康范围内[避免透支][2])。 -有些人喜欢从晚上开始,一直工作到凌晨,而另一些人则很早就起床(例如,凌晨4点),以便在开始日常工作之前完成大部分编程工作。 +有些人喜欢从晚上开始,一直工作到凌晨,而另一些人则很早就起床(例如,凌晨 4 点),以便在开始日常工作之前完成大部分编程工作。 -这种工作习惯可能会使许多开发人员看起来像个怪胎和不称职。 但是,为什么有这么多的程序员喜欢在非正常时间工作,这其中有很多原因: +这种工作习惯可能会使许多开发人员看起来像个怪人,不合时宜。但是,为什么有这么多的程序员喜欢在非正常时间工作,原因有很多: -### maker 日程 +### 制造者日程 -根据[Paul Graham][3]的观点, "生产东西" 的人倾向于遵守 maker's schedule—他们更愿意以半天或更长时间为单位使用时间。事实上,大多数 [开发人员也有相同的偏好][4]. +根据 [保罗·格雷厄姆][3]Paul Graham 的观点,“生产东西”的人倾向于遵守 制造者日程 —— 他们更愿意以半天或更长时间为单位使用时间。事实上,大多数[开发人员也有相同的偏好][4]。(LCTT 译注:保罗·格雷厄姆有[一篇文章][8]述及制造者日程和管理者日程。) -一方面,开发人员从事大型抽象系统工作,需要思维空间来处理整个模型。 将他们的日程分割成15分钟或30分钟的时间段来处理电子邮件,会议,电话以及来自同事的打断,工作效果只会适得其反。 +一方面,开发人员从事大型抽象系统工作,需要思维空间来处理整个模型。将他们的日程分割成 15 分钟或 30 分钟的时间段来处理电子邮件、会议、电话以及来自同事的打断,工作效果只会适得其反。 -另一方面,通常不可能以一个小时为单位进行有效编程。 因为这么短的时间几乎不够来处理当前的任务并开始工作。 +另一方面,通常不可能以小时为单位进行有效编程。因为这么短的时间几乎不够让你把思绪放在手头的任务上并开始工作。 -上下文切换也会对编程产生不利影响。 在晚上工作,开发人员可以避免尽可能多的干扰。 在没有持续中断的情况下,他们可以花几个小时专注于手头任务,并尽可能提高工作效率。 +上下文切换也会对编程产生不利影响。在晚上工作,开发人员可以避免尽可能多的干扰。在没有不断的干扰的情况下,他们可以花几个小时专注于手头任务,并尽可能提高工作效率。 ### 平和安静的环境 -由于晚上或凌晨不太会有来自各种活动的噪音(例如,办公室闲谈,街道上的交通),这使许多程序员感到放松,促使他们更具创造力和生产力,特别是在处理诸如编码之类的精神刺激任务时。 +由于晚上或凌晨不太会有来自各种活动的噪音(例如,办公室闲谈、街道上的交通),这使许多程序员感到放松,促使他们更具创造力和生产力,特别是在处理诸如编码之类的精神刺激任务时。 -独处与平和,加上知道自己将有几个小时不被中断的工作时间,通常会使他们摆脱白天工作计划相关的时间压力,从而产出高质量的工作。 +独处与平静,加上他们知道自己将有几个小时不被中断的工作时间,通常会使他们摆脱白天工作计划相关的时间压力,从而产出高质量的工作。 更不用说了,当解决了一个棘手的问题后,没有什么比尽情享受自己最喜欢的午夜小吃更美好的事情了! - ### 沟通 -与在公司内里工作的程序员相比,从事开源项目的开发人员可以拥有不同的沟通节奏。 大多数开源项目的沟通都是通过邮件或 GitHub 上的评论等渠道异步完成。 很多时候,其他程序员在不同的国家和时区,因此实时交流通常需要开发人员变成一个夜猫子。 +与在公司内工作的程序员相比,从事开源项目的开发人员可以拥有不同的沟通节奏。大多数开源项目的沟通都是通过邮件或 GitHub 上的评论等渠道异步完成的。很多时候,其他程序员在不同的国家和时区,因此实时交流通常需要开发人员变成一个夜猫子。 ### 昏昏欲睡的大脑 +这听起来可能违反直觉,但是随着时间的推移,大脑会变得非常疲倦,因此只能专注于一项任务。晚上工作从根本上消除了多任务处理,而这是保持专注和高效的主要障碍。当大脑处于昏昏欲睡的状态时,你是无法保持专注的! -这听起来可能违反直觉,但是随着时间的推移,大脑会变得非常疲倦,因此只能专注于一项任务。 晚上工作从根本上消除了多任务处理,多任务处理是保持专注和高效的主要障碍。 当大脑处于昏昏欲睡的状态时,你是无法保持专注的! - -许多开发人员在入睡时思考要解决的问题通常会取得重大进展。 潜意识开始工作,答案通常在他们半睡半醒的早些时候就出现了。 - -这不足为奇,因为[睡眠可增强大脑功能][5],可帮助我们理解新信息并进行更有创造性的思考。当解决方案在凌晨出现时,这些开发人员便会起来并开始工作,不错过任何机会。 - +此外,许多开发人员在入睡时思考要解决的问题通常会取得重大进展。潜意识开始工作,答案通常在他们半睡半醒的凌晨时分就出现了。 +这不足为奇,因为[睡眠可增强大脑功能][5],可帮助我们理解新信息并进行更有创造性的思考。当解决方案在凌晨出现时,这些开发人员便会起来开始工作,不错过任何机会。 ### 灵活和创造性思考 -许多程序员体会到晚上创造力会提升。 前额叶皮层,即与集中能力有关的大脑部分,在一天结束时会感到疲倦。 这似乎为某些人提供了更灵活和更具创造性的思考。 +许多程序员体会到晚上创造力会提升。前额叶皮层,即大脑中与集中能力有关的部分,在一天结束时会感到疲倦。这似乎为某些人提供了更灵活和更具创造性的思考。 -匹兹堡大学医学院精神病学助理教授[Brant Hasler][6] 表示:“由于自上而下的控制和'认知抑制'功能较少,大脑可能会解放出来进行更多样化的思考,从而使人们更容易地将不同概念之间的联系建立起来。” 结合轻松环境所带来的积极情绪,开发人员可以更轻松地产生创新想法。 +匹兹堡大学医学院精神病学助理教授 [Brant Hasler][6] 表示:“由于自上而下的控制和‘认知抑制’的减少,大脑可能会解放出来进行更发散的思考,从而使人们更容易地将不同概念之间的联系建立起来。” 结合轻松环境所带来的积极情绪,开发人员可以更轻松地产生创新想法。 -此外,在没有干扰的情况下集中精力几个小时,“沉浸在你做的事情中”。 这可以帮助你更好地专注于项目并参与其中,而不必担心周围发生的事情。 +此外,在没有干扰的情况下集中精力几个小时,“沉浸在你做的事情中”。这可以帮助你更好地专注于项目并参与其中,而不必担心周围发生的事情。 ### 明亮的电脑屏幕 +因为整天看着明亮的屏幕, 许多程序员的睡眠周期被延迟。电脑屏幕发出的蓝光[扰乱我们的昼夜节律][7],延迟了释放诱发睡眠的褪黑激素和提高人的机敏性,并将人体生物钟重置到更晚的时间。从而导致,开发人员往往睡得越来越晚。 -因为整天看着明亮的屏幕, 许多程序员的睡眠周期被延迟。电脑屏幕发出的蓝光[扰乱我们的昼夜节律][7]通过延迟释放诱发睡眠的褪黑激素和提高人的机敏性将人体生物钟重置到更晚的时间。从而导致,开发人员往往睡得越来越晚。 +### 来自过去的影响 -### 过去的影响 - -过去,大多数开发人员是出于必要在晚上工作,因为在白天当公司其他人都在使用服务器时,共享服务器的计算能力支撑不了编程工作,所以开发人员需要等到深夜才能执行白天无法进行的任务,例如测试项目,运行大量的代码编译运行调试周期以及部署新代码。现在尽管服务器功能变强大了,大多数可以满足需求,但夜间工作的趋势仍是这种文化的一部分。 +过去,大多数开发人员是出于必要在晚上工作,因为在白天当公司其他人都在使用服务器时,共享服务器的计算能力支撑不了编程工作,所以开发人员需要等到深夜才能执行白天无法进行的任务,例如测试项目、运行大量的“编码-编译-运行-调试”周期以及部署新代码。现在尽管服务器功能变强大了,大多数可以满足需求,但夜间工作的趋势仍是这种文化的一部分。 ### 结语 -尽管开发人员喜欢在晚上工作出于多种原因,但请记住,成为夜猫子并不意味着你应该克扣睡眠时间。 睡眠不足会导致压力和焦虑,并最终导致倦怠。 +尽管开发人员喜欢在晚上工作的原因很多,但请记住,做为夜猫子并不意味着你应该克扣睡眠时间。睡眠不足会导致压力和焦虑,并最终导致倦怠。 -获得足够质量的睡眠是维持良好身体健康和大脑功能的关键。 例如,它可以帮助你整合新信息,巩固记忆,创造性思考,清除身体积聚的毒素,调节食欲并防止过早衰老。 +获得足够质量的睡眠是维持良好身体健康和大脑功能的关键。例如,它可以帮助你整合新信息、巩固记忆、创造性思考、清除身体积聚的毒素、调节食欲并防止过早衰老。 无论你是哪种日程,请确保让你的大脑得到充分的休息,这样你就可以在一整天及每天的工作中发挥最大的作用! - -------------------------------------------------------------------------------- via: https://opensource.com/article/20/2/why-developers-code-night 作者:[Matt Shealy][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -99,3 +94,4 @@ via: https://opensource.com/article/20/2/why-developers-code-night [5]: https://amerisleep.com/blog/sleep-impacts-brain-health/ [6]: https://www.vice.com/en_us/article/mb58a8/late-night-creativity-spike [7]: https://www.sleepfoundation.org/articles/how-blue-light-affects-kids-sleep +[8]: http://www.paulgraham.com/makersschedule.html From 71d234deb925e87c76c24733f954a0c62c9992d8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 24 Feb 2020 10:44:06 +0800 Subject: [PATCH 056/260] PUB @Morisun029 https://linux.cn/article-11924-1.html --- .../20200213 Why developers like to code at night.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200213 Why developers like to code at night.md (99%) diff --git a/translated/tech/20200213 Why developers like to code at night.md b/published/20200213 Why developers like to code at night.md similarity index 99% rename from translated/tech/20200213 Why developers like to code at night.md rename to published/20200213 Why developers like to code at night.md index 6756b79234..144345c44f 100644 --- a/translated/tech/20200213 Why developers like to code at night.md +++ b/published/20200213 Why developers like to code at night.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11924-1.html) [#]: subject: (Why developers like to code at night) [#]: via: (https://opensource.com/article/20/2/why-developers-code-night) [#]: author: (Matt Shealy https://opensource.com/users/mshealy) From 70e906f1cac03217a338c7528b2467308a032ced Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 24 Feb 2020 11:32:35 +0800 Subject: [PATCH 057/260] PRF @lujun9972 --- ...romium - Firefox sessions with org-mode.md | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/translated/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md b/translated/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md index 7c1bf841df..690e1ec431 100644 --- a/translated/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md +++ b/translated/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md @@ -1,22 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) -[#]: subject: (#:acid 'words: Handle Chromium & Firefox sessions with org-mode) +[#]: subject: (Handle Chromium & Firefox sessions with org-mode) [#]: via: (https://acidwords.com/posts/2019-12-04-handle-chromium-and-firefox-sessions-with-org-mode.html) [#]: author: (Sanel Z https://acidwords.com/) -通过 org-mode 管理 Chromium 和 Firefox 会话 +通过 Org 模式管理 Chromium 和 Firefox 会话 ====== -我是 [Session Manager][1] 的大粉丝,它是 Chrome 和 Chromium 的小插件,可以保存所有打开的选项卡,为会话命名,并在需要时恢复会话。 +![](https://img.linux.net.cn/data/attachment/album/202002/24/113047w8jtoh2o5j085750.jpg) -它非常有用,特别是如果你像我一样,白天的时候需要在多个“思维活动”之间切换——研究、开发或者新闻阅读。或者您只是单纯地希望记住几天前的工作流(和选项卡)。 +我是[会话管理器][1]的铁粉,它是 Chrome 和 Chromium 的小插件,可以保存所有打开的选项卡,为会话命名,并在需要时恢复会话。 -在我决定放弃 chromium 上除了 [uBlock Origin][2] 之外的所有扩展后,也到了寻找替代品的时候了。我的主要目标是使之与浏览器无关同时会话链接需要保存在文本文件中,这样我就可以享受所有纯文本的好处了。还有什么比 [org-mode][3] 更好呢 ;) +它非常有用,特别是如果你像我一样,白天的时候需要在多个“思维活动”之间切换——研究、开发或者阅读新闻。或者你只是单纯地希望记住几天前的工作流(和选项卡)。 -很久以前我就发现了这个小诀窍:[通过命令行获取当前在谷歌 Chrome 中打开的标签 ][4] 再加上些 elisp 代码: +在我决定放弃 chromium 上除了 [uBlock Origin][2] 之外的所有扩展后,就必须寻找一些替代品了。我的主要目标是使之与浏览器无关,同时会话链接必须保存在文本文件中,这样我就可以享受所有纯文本的好处了。还有什么比 [org 模式][3]更好呢 ;) + +很久以前我就发现了这个小诀窍:[通过命令行获取当前在谷歌 Chrome 中打开的标签][4] 再加上些 elisp 代码: ``` (require 'cl-lib) @@ -59,7 +61,7 @@ Make sure to put cursor on date heading that contains list of urls." 那么,它的工作原理是什么呢? -运行上述代码,打开一个新 org-mode 文件并调用 `M-x save-chromium-session`。它会创建类似这样的东西: +运行上述代码,打开一个新 org 模式文件并调用 `M-x save-chromium-session`。它会创建类似这样的东西: ``` * [2019-12-04 12:14:02] @@ -88,20 +90,19 @@ Make sure to put cursor on date heading that contains list of urls." - https://news.ycombinator.com ``` -请注意,用于读取 Chromium 会话的方法并不完美:`strings` 将从二进制数据库中读取任何类似 URL 字符串的内容,有时这将产生不完整的 url。不过,您可以很方便地地编辑它们,从而保持会话文件简洁。 +请注意,用于读取 Chromium 会话的方法并不完美:`strings` 将从二进制数据库中读取任何类似 URL 字符串的内容,有时这将产生不完整的 URL。不过,你可以很方便地地编辑它们,从而保持会话文件简洁。 -为了真正打开标签,elisp 代码中使用到了 [browse-url][5],它可以通过 `browse-url-browser-function` 变量进一步定制成运行 Chromium,Firefox 或任何其他浏览器。请务必阅读该变量的相关文档。 +为了真正打开标签,elisp 代码中使用到了 [browse-url][5],它可以通过 `browse-url-browser-function` 变量进一步定制成运行 Chromium、Firefox 或任何其他浏览器。请务必阅读该变量的相关文档。 别忘了把会话文件放在 git、mercurial 或 svn 中,这样你就再也不会丢失会话历史记录了 :) ### 那么 Firefox 呢? -如果您正在使用 Firefox( 最近的版本),并且想要获取会话 url,下面是操作方法。 +如果你正在使用 Firefox(最近的版本),并且想要获取会话 URL,下面是操作方法。 -首先,下载并编译 [lz4json][6],这是一个可以解压缩 Mozilla lz4json 格式的小工具,Firefox 以这种格式来存储会话数据。会话数据(在撰写本文时)存储在 `$HOME/.mozilla/firefox//sessionstore-backup /recovery.jsonlz4` 中。 +首先,下载并编译 [lz4json][6],这是一个可以解压缩 Mozilla lz4json 格式的小工具,Firefox 以这种格式来存储会话数据。会话数据(在撰写本文时)存储在 `$HOME/.mozilla/firefox//sessionstore-backup /recovery.jsonlz4` 中。 如果 Firefox 没有运行,则没有 `recovery.jsonlz4`,这种情况下用 `previous.jsonlz4` 代替。 -=恢复。jsonlz4= 将不存在,但使用=先前。jsonlz4 =。 要提取网址,尝试在终端运行: @@ -132,7 +133,7 @@ via: https://acidwords.com/posts/2019-12-04-handle-chromium-and-firefox-sessions 作者:[Sanel Z][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 76d61e0cc4e1d7764cfcaba7d458da19bfcdd96d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 24 Feb 2020 11:33:06 +0800 Subject: [PATCH 058/260] PUB @lujun9972 https://linux.cn/article-11926-1.html --- ...words- Handle Chromium - Firefox sessions with org-mode.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md (98%) diff --git a/translated/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md b/published/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md similarity index 98% rename from translated/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md rename to published/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md index 690e1ec431..31c93609ab 100644 --- a/translated/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md +++ b/published/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11926-1.html) [#]: subject: (Handle Chromium & Firefox sessions with org-mode) [#]: via: (https://acidwords.com/posts/2019-12-04-handle-chromium-and-firefox-sessions-with-org-mode.html) [#]: author: (Sanel Z https://acidwords.com/) From d8709fbfe1267f45154c3c5b66b9fefe7ee880cd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 24 Feb 2020 20:17:40 +0800 Subject: [PATCH 059/260] APL --- sources/tech/20200220 Tools for SSH key management.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200220 Tools for SSH key management.md b/sources/tech/20200220 Tools for SSH key management.md index 816993315c..639f5f615e 100644 --- a/sources/tech/20200220 Tools for SSH key management.md +++ b/sources/tech/20200220 Tools for SSH key management.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 032757210377eb88fce81a61af7dbbb8bf90bae7 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Feb 2020 20:47:16 +0800 Subject: [PATCH 060/260] translating by lujun9972 --- .../20200128 Send email and check your calendar with Emacs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200128 Send email and check your calendar with Emacs.md b/sources/tech/20200128 Send email and check your calendar with Emacs.md index 48be7e8e45..fb0183c1da 100644 --- a/sources/tech/20200128 Send email and check your calendar with Emacs.md +++ b/sources/tech/20200128 Send email and check your calendar with Emacs.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lujun9972) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -124,7 +124,7 @@ via: https://opensource.com/article/20/1/emacs-mail-calendar 作者:[Kevin Sonney][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lujun9972](https://github.com/lujun9972) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cc00466d8d4d8fb46a0986d55f44d43eff0be38d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 24 Feb 2020 20:59:57 +0800 Subject: [PATCH 061/260] TSL --- .../20200220 Tools for SSH key management.md | 110 ------------------ .../20200220 Tools for SSH key management.md | 104 +++++++++++++++++ 2 files changed, 104 insertions(+), 110 deletions(-) delete mode 100644 sources/tech/20200220 Tools for SSH key management.md create mode 100644 translated/tech/20200220 Tools for SSH key management.md diff --git a/sources/tech/20200220 Tools for SSH key management.md b/sources/tech/20200220 Tools for SSH key management.md deleted file mode 100644 index 639f5f615e..0000000000 --- a/sources/tech/20200220 Tools for SSH key management.md +++ /dev/null @@ -1,110 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Tools for SSH key management) -[#]: via: (https://opensource.com/article/20/2/ssh-tools) -[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) - -Tools for SSH key management -====== -Time-saving shortcuts for a commonly used open source tool. -![collection of hardware on blue backround][1] - -I use SSH constantly. Every day I find myself logged in to multiple servers and Pis (both in the same room as me and over the internet). I have many devices I need access to, and different requirements for gaining access, so in addition to using various SSH/SCP command options, I have to maintain a config file with all the connection details. - -Over time I’ve come up with a few time-saving tips and tools that you might find useful, too. - -### SSH keys - -SSH keys are a way to authenticate SSH connections without using a password, either to speed up your access or as a security measure, if you turn password access off and ensure only authorized keys are permitted. To create an SSH key, run the command: - - -``` -`$ ssh-keygen` -``` - -This will create a key-pair (a public and private key) in **~/.ssh/**. Keep the private key (id_rsa) on the PC and never share it. You can share the public key (id_rsa.pub) with others or place it on other servers. - -### ssh-copy-id - -If I’m working on a Pi at home or work, I tend to leave SSH settings at their default, as I’m not concerned with security on an internal trusted network, and I usually copy my SSH key to the Pi to avoid having to authenticate with a password every time. To do this, I use the **ssh-copy-id** command to copy it to the Pi. This automatically adds your key to the Pi: - - -``` -`$ ssh-copy-id pi@192.168.1.20` -``` - -On production servers, I tend to turn off password authentication and only allow authorized SSH keys. - -### ssh-import-id - -Another similar tool is ssh-import-id. You can use this to give yourself (or others) access to a computer or server by importing their keys from GitHub. For example, I have registered my various SSH keys with my GitHub account, so I can push to GitHub without a password. These public keys are made available, so ssh-import-id can use them to authorize me from any of my computers: - - -``` -`$ ssh-import-id gh:bennuttall` -``` - -I can also use this to give someone else access to a server without asking them for their keys: - - -``` -`$ ssh-import-id gh:waveform80` -``` - -### storm - -I also use a tool called Storm, which helps you add SSH connections to your SSH config, so you don’t have to remember them all. You can install it with pip: - - -``` -`$ sudo pip3 install stormssh` -``` - -Then you can add an SSH connection to your config with the following command: - - -``` -`$ storm add pi3 pi@192.168.1.20` -``` - -Then you can just use **ssh pi3** to gain access. Similarly, **scp file.txt pi3:** or **sshfs pi pi3:** - -You can also use more SSH options, such as the port number: - - -``` -$ storm add pi3 pi@192.168.1.20:2000 -``` - -You can list, search, and edit saved connections easily using Storm’s [documentation][2]. All Storm actually does is manage items in your ssh config file at **~/.ssh/config**. Once you see how these are stored, you might choose to edit them manually. An example connection in config looks like this: - - -``` -Host pi3 -   user pi -   hostname 192.168.1.20 -   port 22 -``` - -### Conclusion - -SSH is an important tool for system administration, from Raspberry Pi to the largest cloud infrastructures. Familiarizing yourself with key management will forever be handy. Do you have other SSH tricks to add? I would love to have you share them in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/ssh-tools - -作者:[Ben Nuttall][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/bennuttall -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_BUS_Apple_520.png?itok=ZJu-hBV1 (collection of hardware on blue backround) -[2]: https://stormssh.readthedocs.io/en/stable/usage.html diff --git a/translated/tech/20200220 Tools for SSH key management.md b/translated/tech/20200220 Tools for SSH key management.md new file mode 100644 index 0000000000..0c9efe9752 --- /dev/null +++ b/translated/tech/20200220 Tools for SSH key management.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tools for SSH key management) +[#]: via: (https://opensource.com/article/20/2/ssh-tools) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +SSH 密钥管理工具 +====== + +> 常用开源工具的省时快捷方式。 + +![collection of hardware on blue backround][1] + +我经常使用 SSH。我发现自己每天都要登录多个服务器和树莓派(与我位于同一房间,并接入互联网)。我有许多设备需要访问,并且获得访问权限的要求也不同,因此,除了使用各种 `ssh` / `scp` 命令选项之外,我还必须维护一个包含所有连接详细信息的配置文件。 + +随着时间的推移,我发现了一些省时的技巧和工具,你可能也会发现它们有用。 + +### SSH 密钥 + +SSH 密钥是一种在不使用密码的情况下认证 SSH 连接的方法,可以用来加快访问速度或作为一种安全措施(如果你关闭了密码访问权限并确保仅允许授权的密钥)。要创建 SSH 密钥,请运行以下命令: + +``` +$ ssh-keygen +``` + +这将在 `~/.ssh/` 中创建一个密钥对(公钥和私钥)。将私钥(`id_rsa`)保留在 PC 上,切勿共享。你可以与其他人共享公钥(`id_rsa.pub`)或将其放置在其他服务器上。 + +### ssh-copy-id + +如果我在家中或公司工作时使用树莓派,则倾向于将 SSH 设置保留为默认设置,因为我不担心内部信任网络上的安全性,并且通常将 SSH 密钥(公钥)复制到树莓派上,以避免每次都使用密码进行身份验证。为此,我使用 `ssh-copy-id` 命令将其复制到树莓派。这会自动将你的密钥(公钥)添加到树莓派: + +``` +$ ssh-copy-id pi@192.168.1.20 +``` + +在生产服务器上,我倾向于关闭密码身份验证,仅允许授权的 SSH 密钥登录。 + +### ssh-import-id + +另一个类似的工具是 `ssh-import-id`。你可以使用此方法通过从 GitHub 导入密钥来授予你自己(或其他人)对计算机或服务器的访问权限。例如,我已经在我的 GitHub 帐户中注册了各个 SSH 密钥,因此无需密码即可推送到 GitHub。这些公钥是有效的,因此 `ssh-import-id` 可以使用它们在我的任何计算机上授权我: + +``` +$ ssh-import-id gh:bennuttall +``` + +我还可以使用它来授予其他人访问服务器的权限,而无需询问他们的密钥: + +``` +$ ssh-import-id gh:waveform80 +``` + +### storm + +我还使用了名为 Storm 的工具,该工具可帮助你将 SSH 连接添加到 SSH 配置中,因此你不必记住这些连接细节信息。你可以使用 `pip` 安装它: + +``` +$ sudo pip3 install stormssh +``` + +然后,你可以使用以下命令将 SSH 连接添加到配置中: + +``` +$ storm add pi3 pi@192.168.1.20 +``` + +然后,你可以只使用 `ssh pi3` 来获得访问权限。类似的还有 `scp file.txt pi3:` 或 `sshfs pi pi3:`。 + +你还可以使用更多的 SSH 选项,例如端口号: + +``` +$ storm add pi3 pi@192.168.1.20:2000 +``` + +你可以参考 Storm 的[文档][2]轻松列出、搜索和编辑已保存的连接。Storm 实际所做的只是管理 SSH 配置文件 `~/.ssh/config` 中的项目。一旦了解了它们是如何存储的,你就可以选择手动编辑它们。配置中的示例连接如下所示: + +``` +Host pi3 +   user pi +   hostname 192.168.1.20 +   port 22 +``` + +### 结论 + +从树莓派到大型的云基础设施,SSH 是系统管理的重要工具。熟悉密钥管理会很方便。你还有其他 SSH 技巧要添加吗?我希望你在评论中分享他们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/ssh-tools + +作者:[Ben Nuttall][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/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_BUS_Apple_520.png?itok=ZJu-hBV1 (collection of hardware on blue backround) +[2]: https://stormssh.readthedocs.io/en/stable/usage.html From 62462a9d9328b05ff1d17bf3c089d65935817921 Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Mon, 24 Feb 2020 21:31:37 +0800 Subject: [PATCH 062/260] translated --- ...sing Python and GNU Octave to plot data.md | 720 ------------------ ...sing Python and GNU Octave to plot data.md | 689 +++++++++++++++++ 2 files changed, 689 insertions(+), 720 deletions(-) delete mode 100644 sources/tech/20200220 Using Python and GNU Octave to plot data.md create mode 100644 translated/tech/20200220 Using Python and GNU Octave to plot data.md diff --git a/sources/tech/20200220 Using Python and GNU Octave to plot data.md b/sources/tech/20200220 Using Python and GNU Octave to plot data.md deleted file mode 100644 index 5c9bd4facd..0000000000 --- a/sources/tech/20200220 Using Python and GNU Octave to plot data.md +++ /dev/null @@ -1,720 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (heguangzhi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Using Python and GNU Octave to plot data) -[#]: via: (https://opensource.com/article/20/2/python-gnu-octave-data-science) -[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) - -Using Python and GNU Octave to plot data -====== -Learn how to do a common data science task with Python and GNU Octave. -![Analytics: Charts and Graphs][1] - -Data science is a domain of knowledge that spans programming languages. Some are well-known for solving problems in this space, while others are lesser-known. This article will help you become familiar with doing data science with some popular languages. - -### Choosing Python and GNU Octave for data science - -Every so often, I try to learn a new programming language. Why? It is mostly a combination of boredom with the old ways and curiosity about the new ways. When I started programming, the only language I knew was C. Life was hard and dangerous in those years, as I had to manually allocate memory, manage pointers, and remember to free memory. - -Then a friend suggested I try Python, and life became much easier. Programs became much slower, but I did not have to suffer through writing analysis software. However, I soon realized that each language was more suitable than others for some applications. I later studied some other languages, and each one brought some new bit of enlightenment. Discovering new programming styles let me backport some solutions to other languages, and everything became much more interesting. - -To get a feeling for a new programming language (and its documentation), I always start by writing some example programs that perform a task I know well. To that ends, I will explain how to write a program in Python and GNU Octave for a particular task you could classify as data science. If you are already familiar with one of the languages, start with that one and go through the others to look for similarities and differences. It is not intended to be an exhaustive comparison of the languages, just a little showcase. - -All of the programs are meant to be run on the [command line][2], not with a [graphical user interface][3] (GUI). The full examples are available in the [polyglot_fit repository][4]. - -### The programming task - -The program you will write in this series: - - * Reads data from a [CSV file][5] - * Interpolates the data with a straight line (i.e., _f(x)=m ⋅ x + q_) - * Plots the result to an image file - - - -This is a common situation that many data scientists have encountered. The example data is the first set of [Anscombe's quartet][6], shown in the table below. This is a set of artificially constructed data that gives the same results when fitted with a straight line, but their plots are very different. The data file is a text file with tabs as column separators and a few lines as a header. This task will use only the first set (i.e., the first two columns). - -[**Anscombe's quartet**][6] - -I - -II - -III - -IV - -x - -y - -x - -y - -x - -y - -x - -y - -10.0 - -8.04 - -10.0 - -9.14 - -10.0 - -7.46 - -8.0 - -6.58 - -8.0 - -6.95 - -8.0 - -8.14 - -8.0 - -6.77 - -8.0 - -5.76 - -13.0 - -7.58 - -13.0 - -8.74 - -13.0 - -12.74 - -8.0 - -7.71 - -9.0 - -8.81 - -9.0 - -8.77 - -9.0 - -7.11 - -8.0 - -8.84 - -11.0 - -8.33 - -11.0 - -9.26 - -11.0 - -7.81 - -8.0 - -8.47 - -14.0 - -9.96 - -14.0 - -8.10 - -14.0 - -8.84 - -8.0 - -7.04 - -6.0 - -7.24 - -6.0 - -6.13 - -6.0 - -6.08 - -8.0 - -5.25 - -4.0 - -4.26 - -4.0 - -3.10 - -4.0 - -5.39 - -19.0 - -12.50 - -12.0 - -10.84 - -12.0 - -9.13 - -12.0 - -8.15 - -8.0 - -5.56 - -7.0 - -4.82 - -7.0 - -7.26 - -7.0 - -6.42 - -8.0 - -7.91 - -5.0 - -5.68 - -5.0 - -4.74 - -5.0 - -5.73 - -8.0 - -6.89 - -### The Python way - -[Python][7] is a general-purpose programming language that is among the most popular languages in use today (as evidenced by findings from the [TIOBE index][8], [RedMonk Programming Language Rankings][9], [Popularity of Programming Language Index][10], [State of the Octoverse of GitHub][11], and other sources). It is an [interpreted language][12]; therefore, the source code is read and evaluated by a program that executes the instructions. It has a comprehensive [standard library][13] and is generally very pleasant to use (I have no reference for this last statement; it is just my humble opinion). - -#### Installation - -To develop with Python, you need the interpreter and a few libraries. The minimum requirements are: - - * [NumPy][14] for convenient array and matrices manipulation - * [SciPy][15] for scientific calculations - * [Matplotlib][16] for plotting - - - -Installing them in [Fedora][17] is easy: - - -``` -`sudo dnf install python3 python3-numpy python3-scipy python3-matplotlib` -``` - -#### Commenting code - -In Python, [comments][18] are achieved by putting a **#** at the beginning of the line, and the rest of the line will be discarded by the interpreter: - - -``` -`# This is a comment ignored by the interpreter.` -``` - -The [fitting_python.py][19] example uses comments to insert licensing information in the source code, and the first line is a [special comment][20] that enables the script to be executed on the command line: - - -``` -`#! /usr/bin/env python3` -``` - -This line informs the command-line interpreter that the script needs to be executed by the program **python3**. - -#### Required libraries - -Libraries and modules can be imported in Python as an object (as in the first line in the example) with all the functions and members of the library. There is a convenient option to rename them with a custom label by using the **as** specification: - - -``` -import numpy as np -from scipy import stats -import matplotlib.pyplot as plt -``` - -You may also decide to import only a submodule (as in the second and third lines). The syntax has two (more or less) equivalent options: **import module.submodule** and **from module import submodule**. - -#### Defining variables - -Python's variables are declared the first time a value is assigned to them: - - -``` -input_file_name = "anscombe.csv" -delimiter = "\t" -skip_header = 3 -column_x = 0 -column_y = 1 -``` - -The variable types are inferred by the value that is assigned to the variable. There are no variables with constant values unless they are declared in a module and can only be read. Idiomatically, variables that should not be modified should be named in uppercase. - -#### Printing output - -Running the programs through the command line means that the output is just printed on the terminal. Python has the [**print()**][21] function that, by default, prints its argument and adds a newline at the end of the output: - - -``` -`print("#### Anscombe's first set with Python ####")` -``` - -It is possible to combine the **print()** function with the [formatting power][22] of the [string class][23] in Python. Strings have the **format** method that can be used to add some formatted text to the string itself. For instance, it is possible to add a formatted float number, e.g.: - - -``` -`print("Slope: {:f}".format(slope))` -``` - -#### Reading data - -Reading CSV files is very easy with NumPy and the function [**genfromtxt()**][24], which generates a [NumPy array][25]: - - -``` -`data = np.genfromtxt(input_file_name, delimiter = delimiter, skip_header = skip_header)` -``` - -In Python, a function can have a variable number of arguments, and you can have it pass a subset by specifying the desired ones. Arrays are very powerful matrix-like objects that can be easily sliced into smaller arrays: - - -``` -x = data[:, column_x] -y = data[:, column_y] -``` - -The colons select the whole range, and they can also be used to select a subrange. For instance, to select the first two rows of the array, you would use: - - -``` -`first_two_rows = data[0:1, :]` -``` - -#### Fitting data - -SciPy provides convenient functions for data fitting, such as the [**linregress()**][26] function. This function provides some significant values related to the fit, such as the slope, intercept, and the correlation coefficient of the two datasets: - - -``` -slope, intercept, r_value, p_value, std_err = stats.linregress(x, y) - -print("Slope: {:f}".format(slope)) -print("Intercept: {:f}".format(intercept)) -print("Correlation coefficient: {:f}".format(r_value)) -``` - -Since **linregress()** provides several pieces of information, the result can be saved to several variables at the same time. - -#### Plotting - -The Matplotlib library plots only data points; therefore, you should define the points you want to plot. The **x** and **y** arrays were already defined, so you can directly plot them, but you also need data points that will represent the straight line. - - -``` -`fit_x = np.linspace(x.min() - 1, x.max() + 1, 100)` -``` - -The [**linspace()**][27] function conveniently generates a set of equally spaced values between two values. The ordinates can be easily calculated by exploiting the powerful NumPy arrays, which can be used in a formula as if they were ordinary numeric variables: - - -``` -`fit_y = slope * fit_x + intercept` -``` - -The formula is applied element-by-element on the array; therefore, the result has the same number of entries in the initial array. - -To create the plot, first, define a [figure object][28] that will contain all the graphics: - - -``` -fig_width = 7 #inch -fig_height = fig_width / 16 * 9 #inch -fig_dpi = 100 - -fig = plt.figure(figsize = (fig_width, fig_height), dpi = fig_dpi) -``` - -Several plots can be drawn on a figure; in Matplotlib, the plots are called [axes][29]. This example defines a single axis object to plot the data points: - - -``` -ax = fig.add_subplot(111) - -ax.plot(fit_x, fit_y, label = "Fit", linestyle = '-') -ax.plot(x, y, label = "Data", marker = '.', linestyle = '') - -ax.legend() -ax.set_xlim(min(x) - 1, max(x) + 1) -ax.set_ylim(min(y) - 1, max(y) + 1) -ax.set_xlabel('x') -ax.set_ylabel('y') -``` - -Save the figure to a [PNG image file][30] with: - - -``` -`fig.savefig('fit_python.png')` -``` - -If you want to display (instead of saving) the plot, call: - - -``` -`plt.show()` -``` - -This example references all the objects used in the plotting section: it defines the object **fig** and the object **ax**. This technicality is not necessary, as the **plt** object can be used directly to plot the datasets. The [Matplotlib tutorial][31] shows an interface such as: - - -``` -`plt.plot(fit_x, fit_y)` -``` - -Frankly, I do not like this approach because it hides the non-trivial interactions that happen between the various objects. Unfortunately, sometimes the [official examples][32] are a bit confusing because they tend to use different approaches. Referencing graphical objects is not necessary in this simple example, but it becomes important in more complex ones (such as when embedding plots in GUIs). - -#### Results - -The output on the command line is: - - -``` -#### Anscombe's first set with Python #### -Slope: 0.500091 -Intercept: 3.000091 -Correlation coefficient: 0.816421 -``` - -Here is the image Matplotlib generates. - -![Plot and fit of the dataset obtained with Python][33] - -### The GNU Octave way - -The [GNU Octave][34] language is primarily intended for numerical computations. It offers a simple syntax for manipulating vectors and matrices and has some powerful plotting facilities. It is an interpreted language like Python. Since Octave's syntax is [mostly compatible][35] with [MATLAB][36], it is often described as a free alternative to MATLAB. Octave is not listed among the most popular programming languages, but MATLAB is, so Octave is rather popular in a sense. MATLAB predates NumPy, and I have the feeling that it was inspired by the former. While you go through the example, you will see the analogies. - -#### Installation - -The [fitting_octave.m][37] example only needs the basic Octave package, making the installation in Fedora rather simple: - - -``` -`sudo dnf install octave` -``` - -#### Commenting code - -In Octave, you can add comments to code with the percent symbol (**%**), and you can also use **#** if MATLAB compatibility is not needed. The option to use **#** allows you to write the same special comment line from the Python example to execute the script directly on the command line. - -#### Necessary libraries - -Everything used in this example is contained in the basic package, so you do not need to load any new libraries. If you need a library, the [syntax][38] is **pkg load module**. This command adds the module's functions to the list of available functions. In this regard, Python has more flexibility. - -#### Defining variables - -Variables are defined with pretty much the same syntax as Python: - - -``` -input_file_name = "anscombe.csv"; -delimiter = "\t"; -skip_header = 3; -column_x = 1; -column_y = 2; -``` - -Note that the end of the line has a semicolon; this is not necessary, but it suppresses the output of the results of the line. Without a semicolon, the interpreter would print the result of the expression: - - -``` -octave:1> input_file_name = "anscombe.csv" -input_file_name = anscombe.csv -octave:2> sqrt(2) -ans =  1.4142 -``` - -#### Printing output - -The powerful function [**printf()**][39] is used to print on the terminal. Unlike in Python, the **printf()** function does not automatically add a newline at the end of the printed string, so you have to add it. The first argument is a string that can contain format information for the other arguments to be passed to the function, such as: - - -``` -`printf("Slope: %f\n", slope);` -``` - -In Python, the formatting is built into the string itself, but in Octave, it is specific to the **printf()** function. - -#### Reading data - -The [**dlmread()**][40] function can read text files structured like CSV files: - - -``` -`data = dlmread(input_file_name, delimiter, skip_header, 0);` -``` - -The result is a [matrix][41] object, which is one of the fundamental data types in Octave. Matrices may be sliced with a syntax similar to Python: - - -``` -x = data(:, column_x); -y = data(:, column_y); -``` - -The fundamental difference is that the indexes start at one instead of zero. Therefore, in the example, the __x__ column is column number one. - -#### Fitting data - -To fit the data with a straight line, you can use the [**polyfit()**][42] function. It fits the input data with a polynomial, so you just need to use a polynomial of order one: - - -``` -p = polyfit(x, y, 1); - -slope = p(1); -intercept = p(2); -``` - -The result is a matrix with the polynomial coefficients; therefore, it selects the first two indexes. To determine the correlation coefficient, use the [**corr()**][43] function: - - -``` -`r_value = corr(x, y);` -``` - -Finally, print the results with the **printf()** function: - - -``` -printf("Slope: %f\n", slope); -printf("Intercept: %f\n", intercept); -printf("Correlation coefficient: %f\n", r_value); -``` - -#### Plotting - -As in the Matplotlib example, you first need to create a dataset that represents the fitted line: - - -``` -fit_x = linspace(min(x) - 1, max(x) + 1, 100); -fit_y = slope * fit_x + intercept; -``` - -The analogy with NumPy is also evident here, as it uses the [**linspace()**][44] function that behaves just like the Python's equivalent version. - -Again, as with Matplotlib, create a [figure][45] object first, then create an [axes][46] object to hold the plots: - - -``` -fig_width = 7; %inch -fig_height = fig_width / 16 * 9; %inch -fig_dpi = 100; - -fig = figure("units", "inches", -             "position", [1, 1, fig_width, fig_height]); - -ax = axes("parent", fig); - -set(ax, "fontsize", 14); -set(ax, "linewidth", 2); -``` - -To set properties of the axes object, use the [**set()**][47] function. The interface is rather confusing, though, as the function expects a comma-separated list of property and value pairs. These pairs are just a succession of a string representing the property name and a second object representing the value for that property. There are also other functions to set various properties: - - -``` -xlim(ax, [min(x) - 1, max(x) + 1]); -ylim(ax, [min(y) - 1, max(y) + 1]); -xlabel(ax, 'x'); -ylabel(ax, 'y'); -``` - -Plotting is achieved with the [**plot()**][48] function. The default behavior is that each call resets the axes, so you need to use the function [**hold()**][49]. - - -``` -hold(ax, "on"); - -plot(ax, fit_x, fit_y, -     "marker", "none", -     "linestyle", "-", -     "linewidth", 2); -plot(ax, x, y, -     "marker", ".", -     "markersize", 20, -     "linestyle", "none"); - -hold(ax, "off"); -``` - -Also, it is possible in the **plot()** function to add the property and value pairs. The [legend][50] must be created separately, and the labels should be stated manually: - - -``` -lg = legend(ax, "Fit", "Data"); -set(lg, "location", "northwest"); -``` - -Finally, save the output to a PNG image: - - -``` -image_size = sprintf("-S%f,%f", fig_width * fig_dpi, fig_height * fig_dpi); -image_resolution = sprintf("-r%f,%f", fig_dpi); - -print(fig, 'fit_octave.png', -      '-dpng', -      image_size, -      image_resolution); -``` - -Confusingly, in this case, the options are passed as a single string with the property name and the value. Since in Octave strings do not have the formatting facilities of Python, you must use the [**sprintf()**][51] function. It behaves just like the **printf()** function, but its result is not printed, rather it is returned as a string. - -In this example, as in the Python one, the graphical objects are referenced to keep their interactions evident. If Python's documentation in this regard is a little bit confusing, [Octave's documentation][52] is even worse. Most of the examples I found did not care about referencing the objects; instead, they rely on the fact that the plotting commands act on the currently active figure. A global [root graphics object][53] keeps track of the existing figures and axes. - -#### Results - -The resulting output on the command line is: - - -``` -#### Anscombe's first set with Octave #### -Slope: 0.500091 -Intercept: 3.000091 -Correlation coefficient: 0.816421 -``` - -And this shows the resulting image generated with Octave. - -![Plot and fit of the dataset obtained with Octave][54] - -### Next up - -Both Python and GNU Octave can plot the same information, though they differ in how they get there. If you're looking to explore other languages to complete similar tasks, I highly recommend looking at [Rosetta Code][55]. It's a marvelous resource to see how to solve the same problems in many languages.  - -What language do you like to plot data in? Share your thoughts in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/python-gnu-octave-data-science - -作者:[Cristiano L. Fontana][a] -选题:[lujun9972][b] -译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/cristianofontana -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) -[2]: https://en.wikipedia.org/wiki/Command-line_interface -[3]: https://en.wikipedia.org/wiki/Graphical_user_interface -[4]: https://gitlab.com/cristiano.fontana/polyglot_fit -[5]: https://en.wikipedia.org/wiki/Comma-separated_values -[6]: https://en.wikipedia.org/wiki/Anscombe%27s_quartet -[7]: https://www.python.org/ -[8]: https://www.tiobe.com/tiobe-index/ -[9]: https://redmonk.com/sogrady/2019/07/18/language-rankings-6-19/ -[10]: http://pypl.github.io/PYPL.html -[11]: https://octoverse.github.com/ -[12]: https://en.wikipedia.org/wiki/Interpreted_language -[13]: https://docs.python.org/3/library/ -[14]: https://numpy.org/ -[15]: https://www.scipy.org/ -[16]: https://matplotlib.org/ -[17]: https://getfedora.org/ -[18]: https://en.wikipedia.org/wiki/Comment_(computer_programming) -[19]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_python.py -[20]: https://en.wikipedia.org/wiki/Shebang_(Unix) -[21]: https://docs.python.org/3/library/functions.html#print -[22]: https://docs.python.org/3/library/string.html#string-formatting -[23]: https://docs.python.org/3/library/string.html -[24]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.genfromtxt.html -[25]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.array.html -[26]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.linregress.html -[27]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.linspace.html -[28]: https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure -[29]: https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes -[30]: https://en.wikipedia.org/wiki/Portable_Network_Graphics -[31]: https://matplotlib.org/tutorials/introductory/pyplot.html#sphx-glr-tutorials-introductory-pyplot-py -[32]: https://matplotlib.org/gallery/index.html -[33]: https://opensource.com/sites/default/files/uploads/fit_python.png (Plot and fit of the dataset obtained with Python) -[34]: https://www.gnu.org/software/octave/ -[35]: https://wiki.octave.org/FAQ#Differences_between_Octave_and_Matlab -[36]: https://en.wikipedia.org/wiki/MATLAB -[37]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_octave.m -[38]: https://octave.org/doc/v5.1.0/Using-Packages.html#Using-Packages -[39]: https://octave.org/doc/v5.1.0/Formatted-Output.html#XREFprintf -[40]: https://octave.org/doc/v5.1.0/Simple-File-I_002fO.html#XREFdlmread -[41]: https://octave.org/doc/v5.1.0/Matrices.html -[42]: https://octave.org/doc/v5.1.0/Polynomial-Interpolation.html -[43]: https://octave.org/doc/v5.1.0/Correlation-and-Regression-Analysis.html#XREFcorr -[44]: https://octave.sourceforge.io/octave/function/linspace.html -[45]: https://octave.org/doc/v5.1.0/Multiple-Plot-Windows.html -[46]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFaxes -[47]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFset -[48]: https://octave.org/doc/v5.1.0/Two_002dDimensional-Plots.html#XREFplot -[49]: https://octave.org/doc/v5.1.0/Manipulation-of-Plot-Windows.html#XREFhold -[50]: https://octave.org/doc/v5.1.0/Plot-Annotations.html#XREFlegend -[51]: https://octave.org/doc/v5.1.0/Formatted-Output.html#XREFsprintf -[52]: https://octave.org/doc/v5.1.0/Two_002dDimensional-Plots.html#Two_002dDimensional-Plots -[53]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFgroot -[54]: https://opensource.com/sites/default/files/uploads/fit_octave.png (Plot and fit of the dataset obtained with Octave) -[55]: http://www.rosettacode.org/ diff --git a/translated/tech/20200220 Using Python and GNU Octave to plot data.md b/translated/tech/20200220 Using Python and GNU Octave to plot data.md new file mode 100644 index 0000000000..0c11406995 --- /dev/null +++ b/translated/tech/20200220 Using Python and GNU Octave to plot data.md @@ -0,0 +1,689 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Python and GNU Octave to plot data) +[#]: via: (https://opensource.com/article/20/2/python-gnu-octave-data-science) +[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) + +使用 Python 和 GNU Octave 绘制数据 +====== + +了解如何使用 Python 和 GNU Octave 完成一项常见的数据科学任务。 +![分析:图表和图形][1] + +数据科学是跨越编程语言的知识领域。有些人以解决这一领域的问题而闻名,而另一些人则鲜为人知。这篇文章将帮助你熟悉用一些流行语言做数据科学。 + +### 为数据科学选择 Python 和 GNU Octave + +我经常尝试学习一种新的编程语言。为什么?这主要是对旧方式的厌倦和对新方式的好奇的结合。当我开始编程时,我唯一知道的语言是 C 语言。那些年的编程生涯既艰难又危险,因为我不得不手动分配内存,管理指针,并记得释放内存。 + +然后一个朋友建议我试试 Python,现在编程生活变得简单多了。虽然程序运行变得慢多了,但我不必通过编写分析软件来受苦了。然而,我很快就意识到每种语言都有比其他语言更适合自己应用场景。后来我学习了其他一些语言,每种语言都给我带来了一些新的启发。发现新的编程风格让我可以将一些解决方案移植到其他语言中,这样一切都变得有趣多了。 + +为了对一种新的编程语言(及其文档)有所了解,我总是从编写一些执行我熟悉的任务的示例程序开始。为此,我将解释如何用 Python 和 GNU Octave 编写一个程序来完成一个你可以归类为数据科学的特殊任务。如果你已经熟悉其中一种语言,从中开始,浏览其他语言,寻找相似之处和不同之处。这并不是对编程语言的详尽比较,只是一个小小的展示。 + +所有的程序都应该在[命令行][2]上运行,而不是用[图形用户界面][3](GUI)。完整的例子可以在[多语种知识库][4]中找到。 + +### 编程任务 + +你将在本系列中编写的程序: + + * 从[CSV文件][5]中读取数据 + * 用直线插入数据(例如 _f(x)=m ⋅ x + q_) + * 将结果生成图像文件 + +这是许多数据科学家遇到的常见情况。示例数据是第一组[Anscombe's quartet][6],如下表所示。这是一组人工构建的数据,当用直线拟合时会给出相同的结果,但是它们的曲线非常不同。数据文件是一个文本文件,以制表符作为列分隔,以几行作为标题。此任务将仅使用第一组(例如:前两列)。 + +I + +II + +III + +IV + +x + +y + +x + +y + +x + +y + +x + +y + +10.0 + +8.04 + +10.0 + +9.14 + +10.0 + +7.46 + +8.0 + +6.58 + +8.0 + +6.95 + +8.0 + +8.14 + +8.0 + +6.77 + +8.0 + +5.76 + +13.0 + +7.58 + +13.0 + +8.74 + +13.0 + +12.74 + +8.0 + +7.71 + +9.0 + +8.81 + +9.0 + +8.77 + +9.0 + +7.11 + +8.0 + +8.84 + +11.0 + +8.33 + +11.0 + +9.26 + +11.0 + +7.81 + +8.0 + +8.47 + +14.0 + +9.96 + +14.0 + +8.10 + +14.0 + +8.84 + +8.0 + +7.04 + +6.0 + +7.24 + +6.0 + +6.13 + +6.0 + +6.08 + +8.0 + +5.25 + +4.0 + +4.26 + +4.0 + +3.10 + +4.0 + +5.39 + +19.0 + +12.50 + +12.0 + +10.84 + +12.0 + +9.13 + +12.0 + +8.15 + +8.0 + +5.56 + +7.0 + +4.82 + +7.0 + +7.26 + +7.0 + +6.42 + +8.0 + +7.91 + +5.0 + +5.68 + +5.0 + +4.74 + +5.0 + +5.73 + +8.0 + +6.89 + +### Python 方式 + + +[Python][7]是一种通用编程语言,是当今最流行的语言之一(从[TIOBE index][8]、[RedMonk编程语言排名][9]、[编程语言流行指数][10]、[State of the Octoverse of GitHub][11]和其他来源的调查结果可以看出)。这是一种[解释的语言][12];因此,源代码由执行指令的程序读取和评估。它有一个全面的[标准库][13]并且总体上非常好用(我没有参考这最后一句话;这只是我的拙见)。 + +#### 安装 + +要使用 Python 开发,你需要解释器和一些库。最低要求是: + + * [NumPy][14]用于合适的数组和矩阵操作 + * [SciPy][15]进行数据科学 + * [Matplotlib][16]绘图 + +在 [Fedora][17] 安装它们是很容易的: + + +``` +`sudo dnf install python3 python3-numpy python3-scipy python3-matplotlib` +``` + +#### 注释代码 + + +在 Python中,[注释][18]是通过在行首添加一个 **#** 来实现的,该行的其余部分将被解释器丢弃: + +``` +`# This is a comment ignored by the interpreter.` +``` + +[fitting_python.py][19]示例使用注释在源代码中插入许可信息,第一行是[特殊注释][20],它允许在命令行上执行脚本: + +``` +`#! /usr/bin/env python3` +``` +这一行通知命令行解释器,脚本需要由程序**python3**执行。 + +#### Required libraries + +在 Python 中,库和模块可以作为一个对象导入(如示例中的第一行),其中包含库的所有函数和成员。通过使用 **as** 规范可以用于定义标签并重命名它们: + +``` +import numpy as np +from scipy import stats +import matplotlib.pyplot as plt +``` + +你也可以决定只导入一个子模块(如第二行和第三行)。语法有两个(或多或少)等效选项: **import module.submodule** 和 **from module import submodule**。 + +#### 定义变量 + +Python 的变量是在第一次赋值时被声明的: + +``` +input_file_name = "anscombe.csv" +delimiter = "\t" +skip_header = 3 +column_x = 0 +column_y = 1 +``` + +变量类型由分配给变量的值推断。没有常量值的变量,除非它们在模块中声明并且只能被读取。习惯上,不被修改的变量应该用大写字母命名。 + +#### 打印输出 + +通过命令行运行程序意味着输出只能打印在终端上。Python 有[**print()**][21]函数,默认情况下,该函数打印其参数,并在输出的末尾添加一个换行符: + +``` +`print("#### Anscombe's first set with Python ####")` +``` + +在 Python 中,可以将**print()**函数与[字符串类][23]的[格式化能力][22]相结合。字符串具有**format**方法,可用于向字符串本身添加一些格式化文本。例如,可以添加格式化的浮点数,例如: + + +``` +`print("Slope: {:f}".format(slope))` +``` + +#### 读取数据 + +使用 NumPy 和 函数[**genfromtxt()**][24]读取CSV文件非常容易,该函数生成[NumPy数组][25]: + + +``` +`data = np.genfromtxt(input_file_name, delimiter = delimiter, skip_header = skip_header)` +``` + +在 Python中,一个函数可以有可变数量的参数,您可以通过指定所需的参数来让它传递一个子集。数组是非常强大的矩阵状对象,可以很容易地分割成更小的数组: + +``` +x = data[:, column_x] +y = data[:, column_y] +``` + +冒号选择整个范围,也可以用来选择子范围。例如,要选择数组的前两行,可以使用: + +``` +`first_two_rows = data[0:1, :]` +``` + +#### 拟合数据 + +SciPy提供了方便的数据拟合功能,例如[**linregress()**][26]功能。该函数提供了一些与拟合相关的重要值,如斜率、截距和两个数据集的相关系数: + +``` +slope, intercept, r_value, p_value, std_err = stats.linregress(x, y) + +print("Slope: {:f}".format(slope)) +print("Intercept: {:f}".format(intercept)) +print("Correlation coefficient: {:f}".format(r_value)) +``` + +因为**linregress()**提供了几条信息,所以结果可以同时保存到几个变量中。 + +#### 绘图 + +Matplotlib 库仅仅绘制数据点,因此,你应该定义要绘制的点的坐标。已经定义了**x** 和 **y** 数组,所以你可以直接绘制它们,但是你还需要代表直线的数据点。 + +``` +`fit_x = np.linspace(x.min() - 1, x.max() + 1, 100)` +``` + +[**linspace()**][27]函数可以方便地在两个值之间生成一组等距值。利用强大的 NumPy 数组可以轻松计算纵坐标,该数组可以像普通数值变量一样在公式中使用: + +``` +`fit_y = slope * fit_x + intercept` +``` + +公式在数组中逐元素应用;因此,结果在初始数组中具有相同数量的条目。 + +要绘图,首先,定义一个包含所有图形的[图形对象][28]: + +``` +fig_width = 7 #inch +fig_height = fig_width / 16 * 9 #inch +fig_dpi = 100 + +fig = plt.figure(figsize = (fig_width, fig_height), dpi = fig_dpi) +``` + +一个图形可以画几个图;在 Matplotlib 中,这些图块被称为[轴][29]。本示例定义一个单轴对象来绘制数据点: + +``` +ax = fig.add_subplot(111) + +ax.plot(fit_x, fit_y, label = "Fit", linestyle = '-') +ax.plot(x, y, label = "Data", marker = '.', linestyle = '') + +ax.legend() +ax.set_xlim(min(x) - 1, max(x) + 1) +ax.set_ylim(min(y) - 1, max(y) + 1) +ax.set_xlabel('x') +ax.set_ylabel('y') +``` + +将该图保存到[PNG image file][30]中,有: + +``` +`fig.savefig('fit_python.png')` +``` + +如果要显示(而不是保存)绘图,请调用: + + +``` +`plt.show()` +``` + +此示例引用了绘图部分中使用的所有对象:它定义了对象 **fig** 和对象 **ax**。这种技术细节是不必要的,因为 **plt** 对象可以直接用于绘制数据集。《[Matplotlib 教程][31]展示了这样一个界面: + +``` +`plt.plot(fit_x, fit_y)` +``` + +坦率地说,我不喜欢这种方法,因为它隐藏了各种对象之间发生的重要的的交互。不幸的是,有时[官方的例子][32]有点令人困惑,因为他们倾向于使用不同的方法。在这个简单的例子中,引用图形对象是不必要的,但是在更复杂的例子中(例如在图形用户界面中嵌入图形时),引用图形对象就变得很重要了。 + +#### 结果 + +命令行输入: + +``` +#### Anscombe's first set with Python #### +Slope: 0.500091 +Intercept: 3.000091 +Correlation coefficient: 0.816421 +``` + +这是 Matplotlib 产生的图像: + +![Plot and fit of the dataset obtained with Python][33] + +### GNU Octave 方式 + +[GNU Octave][34]语言主要用于数值计算。它提供了一个简单的操作向量和矩阵的语法,并且有一些强大的绘图工具。这是一种像 Python 一样的解释语言。由于 Octave的语法是[最兼容][35] [MATLAB][36],它经常被描述为一个免费的替代 MATLAB 的方案。Octave 没有被列为最流行的编程语言,但是 MATLAB 是,所以 Octave 在某种意义上是相当流行的。MATLAB 早于 NumPy,我觉得它是受到了前者的启发。当你看这个例子时,你会看到相似之处。 + +#### 安装 + +[fitting_octave.m][37]的例子只需要基本的 Octave 包,在 Fedora 中安装相当简单: + +``` +`sudo dnf install octave` +``` + +#### 注释代码 + +在Octave中,你可以用百分比符号(**%**)为代码添加注释,如果不需要与 MATLAB 兼容,你也可以使用 **#**。使用 **#** 的选项允许你从 Python 示例中编写相同的特殊注释行,以便直接在命令行上执行脚本。 + +#### 必要的库 + +本例中使用的所有内容都包含在基本包中,因此你不需要加载任何新的库。如果你需要一个库,[语法][38]是 **pkg load module**。该命令将模块的功能添加到可用功能列表中。在这方面,Python 具有更大的灵活性。 + +#### 定义变量 + +变量的定义与 Python 的语法基本相同: + +``` +input_file_name = "anscombe.csv"; +delimiter = "\t"; +skip_header = 3; +column_x = 1; +column_y = 2; +``` + +请注意,行尾有一个分号;这不是必需的,但是它会抑制行结果的输出。如果没有分号,解释器将打印表达式的结果: + +``` +octave:1> input_file_name = "anscombe.csv" +input_file_name = anscombe.csv +octave:2> sqrt(2) +ans =  1.4142 +``` + +#### 打印输出结果 + +强大的功能[**printf()**][39]是用来在终端上打印的。与 Python 不同,**printf()** 函数不会自动在打印字符串的末尾添加换行,因此你必须添加它。第一个参数是一个字符串,可以包含要传递给函数的其他参数的格式信息,例如: + +``` +`printf("Slope: %f\n", slope);` +``` + +在 Python 中,格式是内置在字符串本身中的,但是在 Octave 中,它是特定于 **printf()** 函数。 + +#### 读取数据 + +[**dlmread()**][40]函数可以读取类似CSV文件的文本内容: + +``` +`data = dlmread(input_file_name, delimiter, skip_header, 0);` +``` + +结果是一个[矩阵][41]对象,这是 Octave 中的基本数据类型之一。矩阵可以用类似于 Python 的语法进行切片: + +``` +x = data(:, column_x); +y = data(:, column_y); +``` + +根本的区别是索引从1开始,而不是从0开始。因此,在该示例中,__x__列是第一列。 + +#### 拟合数据 + +要用直线拟合数据,可以使用[**polyfit()**][42]函数。它用一个多项式拟合输入数据,所以你只需要使用一阶多项式: + + +``` +p = polyfit(x, y, 1); + +slope = p(1); +intercept = p(2); +``` + +结果是具有多项式系数的矩阵;因此,它选择前两个索引。要确定相关系数,请使用[**corr()**][43]函数: + + +``` +`r_value = corr(x, y);` +``` + +最后,使用 **printf()** 函数打印结果: + +``` +printf("Slope: %f\n", slope); +printf("Intercept: %f\n", intercept); +printf("Correlation coefficient: %f\n", r_value); +``` + +#### 绘图 + +与 Matplotlib 示例一样,首先需要创建一个表示拟合直线的数据集: + +``` +fit_x = linspace(min(x) - 1, max(x) + 1, 100); +fit_y = slope * fit_x + intercept; +``` + +与 NumPy 的相似性也很明显,因为它使用了[**linspace()**][44]函数,其行为就像 Python 的等效版本一样。 + +同样,与 Matplotlib 一样,首先创建一个[图][45]对象,然后创建一个[轴][46]对象来保存这些图: + +``` +fig_width = 7; %inch +fig_height = fig_width / 16 * 9; %inch +fig_dpi = 100; + +fig = figure("units", "inches", +             "position", [1, 1, fig_width, fig_height]); + +ax = axes("parent", fig); + +set(ax, "fontsize", 14); +set(ax, "linewidth", 2); +``` + + +要设置轴对象的属性,请使用[**set()**][47]函数。然而,该接口相当混乱,因为该函数需要一个逗号分隔的属性和值对列表。这些对只是代表属性名的一个字符串和代表该属性值的第二个对象的连续。还有其他设置各种属性的功能: + +``` +xlim(ax, [min(x) - 1, max(x) + 1]); +ylim(ax, [min(y) - 1, max(y) + 1]); +xlabel(ax, 'x'); +ylabel(ax, 'y'); +``` + +标图是用[**plot()**][48]功能实现的。默认行为是每次调用都会重置坐标轴,因此需要使用函数[**hold()**][49]。 + + +``` +hold(ax, "on"); + +plot(ax, fit_x, fit_y, +     "marker", "none", +     "linestyle", "-", +     "linewidth", 2); +plot(ax, x, y, +     "marker", ".", +     "markersize", 20, +     "linestyle", "none"); + +hold(ax, "off"); +``` + +此外,还可以在 **plot()** 函数中添加属性和值对。[legend][50]必须单独创建,标签应手动声明: + +``` +lg = legend(ax, "Fit", "Data"); +set(lg, "location", "northwest"); +``` + +最后,将输出保存到PNG图像: + +``` +image_size = sprintf("-S%f,%f", fig_width * fig_dpi, fig_height * fig_dpi); +image_resolution = sprintf("-r%f,%f", fig_dpi); + +print(fig, 'fit_octave.png', +      '-dpng', +      image_size, +      image_resolution); +``` + +令人困惑的是,在这种情况下,选项被作为一个字符串传递,带有属性名和值。因为在 Octave 字符串中没有 Python 的格式化工具,所以必须使用[**sprintf()**][51]函数。它的行为就像**printf()**函数,但是它的结果不是打印出来的,而是作为字符串返回的。 + +在这个例子中,就像在 Python 中一样,图形对象很明显被引用以保持它们之间的交互。如果说 Python 在这方面的文档有点混乱,那么[Octave 的文档][52]就更糟糕了。我发现的大多数例子都不关心引用对象;相反,它们依赖于绘图命令作用于当前活动图形。全局[根图形对象][53]跟踪现有的图形和轴。 + +#### 结果 + +命令行上的结果输出是: + +``` +#### Anscombe's first set with Octave #### +Slope: 0.500091 +Intercept: 3.000091 +Correlation coefficient: 0.816421 +``` + +它显示了用 Octave 生成的结果图像。 + +![Plot and fit of the dataset obtained with Octave][54] + +### 下一个 + +Python 和 GNU Octave 都可以绘制出相同的信息,尽管它们的实现方式不同。如果你想探索其他语言来完成类似的任务,我强烈建议你看看[Rosetta 代码][55]。这是一个了不起的资源,可以看到如何用多种语言解决同样的问题。 + +你喜欢用什么语言绘制数据?在评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/python-gnu-octave-data-science + +作者:[Cristiano L. Fontana][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cristianofontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) +[2]: https://en.wikipedia.org/wiki/Command-line_interface +[3]: https://en.wikipedia.org/wiki/Graphical_user_interface +[4]: https://gitlab.com/cristiano.fontana/polyglot_fit +[5]: https://en.wikipedia.org/wiki/Comma-separated_values +[6]: https://en.wikipedia.org/wiki/Anscombe%27s_quartet +[7]: https://www.python.org/ +[8]: https://www.tiobe.com/tiobe-index/ +[9]: https://redmonk.com/sogrady/2019/07/18/language-rankings-6-19/ +[10]: http://pypl.github.io/PYPL.html +[11]: https://octoverse.github.com/ +[12]: https://en.wikipedia.org/wiki/Interpreted_language +[13]: https://docs.python.org/3/library/ +[14]: https://numpy.org/ +[15]: https://www.scipy.org/ +[16]: https://matplotlib.org/ +[17]: https://getfedora.org/ +[18]: https://en.wikipedia.org/wiki/Comment_(computer_programming) +[19]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_python.py +[20]: https://en.wikipedia.org/wiki/Shebang_(Unix) +[21]: https://docs.python.org/3/library/functions.html#print +[22]: https://docs.python.org/3/library/string.html#string-formatting +[23]: https://docs.python.org/3/library/string.html +[24]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.genfromtxt.html +[25]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.array.html +[26]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.linregress.html +[27]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.linspace.html +[28]: https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure +[29]: https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes +[30]: https://en.wikipedia.org/wiki/Portable_Network_Graphics +[31]: https://matplotlib.org/tutorials/introductory/pyplot.html#sphx-glr-tutorials-introductory-pyplot-py +[32]: https://matplotlib.org/gallery/index.html +[33]: https://opensource.com/sites/default/files/uploads/fit_python.png (Plot and fit of the dataset obtained with Python) +[34]: https://www.gnu.org/software/octave/ +[35]: https://wiki.octave.org/FAQ#Differences_between_Octave_and_Matlab +[36]: https://en.wikipedia.org/wiki/MATLAB +[37]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_octave.m +[38]: https://octave.org/doc/v5.1.0/Using-Packages.html#Using-Packages +[39]: https://octave.org/doc/v5.1.0/Formatted-Output.html#XREFprintf +[40]: https://octave.org/doc/v5.1.0/Simple-File-I_002fO.html#XREFdlmread +[41]: https://octave.org/doc/v5.1.0/Matrices.html +[42]: https://octave.org/doc/v5.1.0/Polynomial-Interpolation.html +[43]: https://octave.org/doc/v5.1.0/Correlation-and-Regression-Analysis.html#XREFcorr +[44]: https://octave.sourceforge.io/octave/function/linspace.html +[45]: https://octave.org/doc/v5.1.0/Multiple-Plot-Windows.html +[46]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFaxes +[47]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFset +[48]: https://octave.org/doc/v5.1.0/Two_002dDimensional-Plots.html#XREFplot +[49]: https://octave.org/doc/v5.1.0/Manipulation-of-Plot-Windows.html#XREFhold +[50]: https://octave.org/doc/v5.1.0/Plot-Annotations.html#XREFlegend +[51]: https://octave.org/doc/v5.1.0/Formatted-Output.html#XREFsprintf +[52]: https://octave.org/doc/v5.1.0/Two_002dDimensional-Plots.html#Two_002dDimensional-Plots +[53]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFgroot +[54]: https://opensource.com/sites/default/files/uploads/fit_octave.png (Plot and fit of the dataset obtained with Octave) +[55]: http://www.rosettacode.org/ From 44d57572779f5b397e8662cf7a713281da4b0317 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Feb 2020 21:52:56 +0800 Subject: [PATCH 063/260] translate done: 20200128 Send email and check your calendar with Emacs.md --- ...6 things you should be doing with Emacs.md | 53 +++++- ...mail and check your calendar with Emacs.md | 152 ----------------- ...mail and check your calendar with Emacs.md | 154 ++++++++++++++++++ 3 files changed, 200 insertions(+), 159 deletions(-) delete mode 100644 sources/tech/20200128 Send email and check your calendar with Emacs.md create mode 100644 translated/tech/20200128 Send email and check your calendar with Emacs.md diff --git a/sources/tech/20200123 6 things you should be doing with Emacs.md b/sources/tech/20200123 6 things you should be doing with Emacs.md index b01830cd8e..059cd4b18e 100644 --- a/sources/tech/20200123 6 things you should be doing with Emacs.md +++ b/sources/tech/20200123 6 things you should be doing with Emacs.md @@ -8,84 +8,123 @@ [#]: author: (Seth Kenlon https://opensource.com/users/seth) 6 things you should be doing with Emacs +你应该用Emacs做的6件事 ====== Here are six things you may not have realized you could do with Emacs. +下面是您可能没有意识到的Emacs可以做的六件事。 Then, get our new cheat sheet to get the most out of Emacs. +然后,使用我们的新备忘单来充分利用Emacs。 ![Text editor on a browser, in blue][1] +[在蓝色浏览器上给编辑发短信][1] Imagine using Python's IDLE interface to edit text. You would be able to load files into memory, edit them, and save changes. But every action you perform would be defined by a Python function. Making a word all capitals, for instance, calls **upper()**, opening a file calls **open**, and so on. Everything in your text document is a Python object and can be manipulated accordingly. From the user's perspective, it's the same experience as any text editor. For a Python developer, it's a rich Python environment that can be changed and developed with just a few custom functions in a config file. +想象一下使用Python的空闲接口来编辑文本。您可以将文件加载到内存中,编辑它们,并保存更改。但是您执行的每个操作都将由Python函数定义。例如,使一个单词全部大写,调用**upper()**,打开一个文件调用**open**,等等。文本文档中的所有内容都是Python对象,可以相应地进行操作。从用户的角度来看,这与任何文本编辑器的体验都是一样的。对于Python开发人员来说,这是一个丰富的Python环境,只需在配置文件中添加几个自定义函数就可以对其进行更改和开发。 This is what [Emacs][2] does for the 1958 programming language [Lisp][3]. In Emacs, there's no separation between the Lisp engine running the application and the arbitrary text you type into it. To Emacs, everything is Lisp data, so everything can be analyzed and manipulated programmatically. +这就是[Emacs][2]对1958年的编程语言[Lisp][3]所做的。在Emacs中,运行应用程序的Lisp引擎与您输入的任意文本之间没有分离。对于Emacs,一切都是Lisp数据,因此一切都可以通过编程进行分析和操作。 That makes for a powerful user interface (UI). But if you're a casual Emacs user, you may only be scratching the surface of what it can do for you. Here are six things you may not have realized you could do with Emacs. +这就形成了一个强大的用户界面(UI)。但是,如果您是Emacs的普通用户,您可能只了解它能为您做些什么。下面是您可能没有意识到的Emacs可以做的六件事。 ## Use Tramp mode for cloud editing +使用流浪汉模式进行克劳德编辑 Emacs has been network-transparent for a lot longer than has been trendy, and today it still provides one of the smoothest remote editor experiences available. The [Tramp mode][4] in Emacs (formerly known as RPC mode) stands for "Transparent Remote (file) Access, Multiple Protocol," which spells out exactly what it offers: easy access to remote files you want to edit over most popular network protocols. The most popular and safest protocol for remote editing these days is [OpenSSH][5], so that's the default. +Emacs实现网络透明的时间要比流行的时间长得多,而且时至今日,它仍然提供最流畅的远程编辑体验。Emacs中的[Tramp模式][4](以前称为RPC模式)代表“透明的远程(文件)访问,多协议”,它详细说明了它提供的功能:通过最流行的网络协议轻松访问您希望编辑的远程文件。目前最流行、最安全的远程编辑协议是[OpenSSH][5],因此它是默认的。 Tramp is already included in Emacs 22.1 or greater, so to use Tramp, you just open a file in the Tramp syntax. In the **File** menu of Emacs, select **Open File**. When prompted in the mini-buffer at the bottom of the Emacs window, enter the file name using this syntax: +在Emacs 22.1或更高版本中已经包含了Tramp,因此要使用Tramp,只需在Tramp语法中打开一个文件。在Emacs的**File**菜单中,选择**Open File**。当在Emacs窗口底部的小缓冲区中出现提示时,使用以下语法输入文件名: ``` +引用---------------------------------------------------- `/ssh:user@example.com:/path/to/file` ``` If you are required to log in interactively, Tramp prompts you for your password. However, Tramp uses OpenSSH directly, so to avoid interactive prompts, you can also add your hostname, username, and SSH key path to your **~/.ssh/config** file. Like Git, Emacs uses your SSH config first and only stops to ask for more information in the event of an error. +如果需要交互式登录,Tramp会提示您输入密码。但是,Tramp直接使用OpenSSH,所以为了避免交互提示,您还可以将您的主机名、用户名和SSH密钥路径添加到您的**~/。ssh / config文件* *。与Git一样,Emacs首先使用SSH配置,只有在出现错误时才会停下来询问更多信息。 Tramp is great for editing files that don't exist on your computer, and the user experience is not noticeably any different from editing a local file. The next time you start to SSH into a server just to launch a Vim or Emacs session, try Tramp instead. +Tramp非常适合编辑计算机上不存在的文件,用户体验与编辑本地文件没有明显的区别。下一次,当您为了启动Vim或Emacs会话而开始SSH到服务器时,请尝试使用Tramp。 ## Calendaring +# Calendaring If you parse text better than you parse graphical interfaces, you'll be happy to know that you can schedule your day (or life) in plain text with Emacs but still get fancy notifications on your mobile device with open source [Org mode][6] viewers. +如果您解析文本比解析图形界面更好,那么您会很高兴地知道,您可以使用Emacs以纯文本方式安排您的一天(或生活),但仍然可以在您的移动设备上使用开放源码[Org模式][6]查看器获得花哨的通知。 The process takes a little setup to create a convenient way to sync your agenda with your mobile device (I use Git, but you could invoke Bluetooth, KDE Connect, Nextcloud, or your file synchronization tool of choice), and you have to install an Org mode viewer (such as [Orgzly][7]) and a Git client app on your mobile. Once you've got your infrastructure sorted, though, the process is inherently perfectly integrated with your usual (or developing, if you're a new user) Emacs workflow. You can refer to your agenda easily in Emacs, make updates to your schedule, and generally stay on task. Pushing changes to your agenda is reflected on your mobile, so you can stay organized even when Emacs isn't available. +这个过程需要一些设置创建一个方便的方式来移动设备同步你的议程(我使用Git,但你可以调用蓝牙,KDE连接,Nextcloud,或您的文件同步工具的选择),你必须安装一个组织模式查看器(如[Orgzly][7])和一个Git客户对你的移动应用程序。但是,一旦您对基础设施进行了排序,该流程就会与您通常使用的Emacs工作流完美地集成在一起(如果您是新用户,则会进行开发)。您可以在Emacs中方便地查阅您的日程,更新您的日程,并通常停留在任务上。推动您的议程的变化反映在您的移动设备上,因此即使Emacs不可用,您也可以保持组织性。 ![][8] Intrigued? Read my step-by-step guide about [calendaring with Org mode and Git][9]. +感兴趣吗?阅读我的关于[使用Org模式和Git进行日历][9]的逐步指南。 ## Access the terminal +访问终端 There are [lots of terminal emulators][10] available. Although the Elisp terminal emulator in Emacs isn't the greatest general-purpose one, it's got two notable advantages. +有[许多终端模拟器][10]可用。尽管Emacs中的Elisp终端仿真器不是最强大的通用仿真器,但是它有两个显著的优点。 - 1. **Opens in an Emacs buffer: **I use Emacs' Elisp shell because it's conveniently located in my Emacs window, which I often run in fullscreen. It's a small but significant advantage to have a terminal just a **Ctrl+x+o** (or C-x o in Emacs notation) away, and it's especially nice to be able to glance over at it for status reports when it's running a lengthy job. - 2. **Easy copying and pasting if no system clipboard is available:** Whether I'm too lazy to move my hand from the keys to the mouse, or I don't have mouse functionality because I'm running Emacs in a remote console, having a terminal in Emacs can sometimes mean a quick transfer of data from my Emacs buffer to Bash. +1. **Opens in an Emacs buffer: **I use Emacs' Elisp shell because it's conveniently located in my Emacs window, which I often run in fullscreen. It's a small but significant advantage to have a terminal just a **Ctrl+x+o** (or C-x o in Emacs notation) away, and it's especially nice to be able to glance over at it for status reports when it's running a lengthy job. +1. 我使用Emacs的Elisp shell,因为它方便地位于我的Emacs窗口,我经常在全屏运行。这是一个小但重要的优势,有一个终端只是**Ctrl+x+o**(或C-x o在Emacs符号),它是特别好的,能够浏览它的状态报告,当它运行一个漫长的作业。 +2. **Easy copying and pasting if no system clipboard is available:** Whether I'm too lazy to move my hand from the keys to the mouse, or I don't have mouse functionality because I'm running Emacs in a remote console, having a terminal in Emacs can sometimes mean a quick transfer of data from my Emacs buffer to Bash. +2. * *简单的复制和粘贴,如果没有可用系统剪贴板:* *是否我太懒惰的关键将我的手从鼠标,或者我没有鼠标功能,因为我在远程控制台运行Emacs,在Emacs有时意味着终端快速传输数据从我的Emacs缓冲Bash。 To try the Emacs terminal, type **Alt**+**x** (**M-x** in Emacs notation), then type **shell**, and press **Return**. +要尝试Emacs终端,输入**Alt**+**x** (Emacs符号中的**M-x**),然后输入**shell**,然后按**Return**。 ## Use Racket mode +使用球拍模式 [Racket][11] is an exciting emerging Lisp dialect with a dynamic programming environment, a GUI toolkit, and a passionate community. The default editor when learning Racket is DrRacket, which has a Definitions panel at the top and an Interactions panel at the bottom. Using this setup, the user writes definitions that affect the Racket runtime. Imagine the old [Logo Turtle][12] program, but with a terminal instead of just a turtle. +[11]是一种激动人心的新兴Lisp语言,拥有动态编程环境、GUI工具包和热情的社区。学习球拍的默认编辑器是dr球拍,它的顶部有一个定义面板,底部有一个交互面板。使用此设置,用户可以编写影响球拍运行时的定义。想象一下旧的[Logo Turtle][12]程序,但是有一个终端而不是一个Turtle。 ![Racket-mode][13] +[Racket-mode] [13] ! LGPL sample code by PLT +由PLT提供的LGPL示例代码 Emacs, being based on Lisp, makes a great integrated development environment (IDE) for advanced Racket coders. It doesn't ship with [Racket mode][14] (yet), but you can install Racket mode and several other helper extensions using the Emacs package installer. To install it, press **Alt**+**X** (**M-x** in Emacs notation), type **package-install**, and press **Return**. Then enter the package you want to install (**racket-mode**), and press **Return**. +基于Lisp的Emacs为高级球拍编程人员提供了一个很好的集成开发环境(IDE)。它还没有[球拍模式][14],但你可以安装球拍模式和其他几个助手扩展使用Emacs包安装程序。要安装它,按**Alt**+**X** (**M-x** Emacs符号),键入**package-install**,然后按**Return**。然后输入要安装的包(**rac模式**),按**Return**。 Enter Racket mode with **M-x racket-mode**. If you're new to Racket but not to Lisp or Emacs, start with the excellent [Quick introduction to Racket with pictures][15]. +进入球拍模式,使用**M-x球拍模式**。如果你是球拍新手,但不是口齿不清或Emacs,开始优秀[快速介绍球拍与图片][15]。 ## Scripting +# # Scripting You might know that Bash scripts are popular for automating and enhancing your Linux or Unix experience. You may have heard that Python does a pretty good job of that, too. But did you know that Lisp scripts can be run in much the same way? There's sometimes confusion about just how useful Lisp really is because many people are introduced to Lisp through Emacs, so there's the latent impression that the only way to run Lisp in the 21st century is to open an Emacs window. Luckily, that's not the case at all, and Emacs is a great IDE for the tools that enable you to run Lisp scripts as general system executables. +您可能知道,Bash脚本在自动化和增强您的Linux或Unix体验方面很流行。您可能听说过Python在这方面也做得很好。但是你知道Lisp脚本可以用同样的方式运行吗?有时人们会对Lisp到底有多有用感到困惑,因为许多人是通过Emacs来了解Lisp的,因此有一种潜在的印象,即在21世纪运行Lisp的惟一方法是打开Emacs窗口。幸运的是,事实并非如此,Emacs是一个很好的IDE,它支持将Lisp脚本作为一般的系统可执行文件来运行。 There are two popular modern Lisps, aside from Elisp, that are easy to run as standalone scripts. +除了Elisp之外,有两种流行的现代lisp很容易作为独立脚本运行。 - 1. **Racket:** You can run Racket scripts relying on your system's Racket install to provide runtime support, or you can use **raco exe** to produce an executable. The **raco exe** command packages your code together with runtime support files to create an executable. The **raco distribute** command then packages that executable into a distribution that works on other machines. Emacs has many Racket-specific tools, so creating Racket files in Emacs is easy and efficient. +1. **Racket:** You can run Racket scripts relying on your system's Racket install to provide runtime support, or you can use **raco exe** to produce an executable. The **raco exe** command packages your code together with runtime support files to create an executable. The **raco distribute** command then packages that executable into a distribution that works on other machines. Emacs has many Racket-specific tools, so creating Racket files in Emacs is easy and efficient. +1. **球拍:**你可以运行球拍脚本依赖于你的系统的球拍安装提供运行时支持,或者你可以使用**raco exe**产生一个可执行文件。**raco exe**命令将代码和运行时支持文件打包,以创建可执行文件。然后,**raco distribution **命令将可执行文件打包到在其他机器上工作的发行版中。Emacs有许多特定于球拍的工具,因此在Emacs中创建球拍文件既简单又有效。 - 2. **GNU Guile:** [GNU Guile][16] (short for "GNU Ubiquitous Intelligent Language for Extensions") is an implementation of the [Scheme][17] programming language that's used for creating applications and games for the desktop, internet, terminal, and more. Writing Scheme is easy, using any one of the many Scheme extensions in Emacs. For example, here's a "Hello world" script in Guile: [code] #!/usr/bin/guile -s +2. **GNU Guile:** [GNU Guile][16] (short for "GNU Ubiquitous Intelligent Language for Extensions") is an implementation of the [Scheme][17] programming language that's used for creating applications and games for the desktop, internet, terminal, and more. Writing Scheme is easy, using any one of the many Scheme extensions in Emacs. For example, here's a "Hello world" script in Guile: [code] #!/usr/bin/guile -s +2. **GNU Guile:** [GNU Guile][16](“GNU通用智能语言扩展”的缩写)是[Scheme][17]编程语言的一个实现,它用于为桌面、internet、终端等创建应用程序和游戏。使用Emacs中众多Scheme扩展中的任何一个,编写Scheme都很容易。例如,这里有一个用Guile编写的“Hello world”脚本:[code] #!/usr/bin/guile - s !# (display "hello world") +(显示“hello world”)      (newline) [/code] Compile and run it with the **guile** command: [code] $ guile ./hello.scheme +(换行)[/code]编译并运行**guile**命令:[code] $ guile ./hello.scheme ;;; compiling /home/seth/./hello.scheme +;;;compiling / home /塞斯-你好。怀廷 ;;; compiled [...]/hello.scheme.go +;;;[…]/ hello.scheme.go编译 hello world +你好,世界 $ guile ./hello.scheme -hello world +你好,scheme +hello world +你好,世界 ``` +引用---------------------------------------------------- ## Run Elisp without Emacs - -Emacs can serve as an Elisp runtime, but you don't have to "open" Emacs in the traditional sense. The **\--script** option allows you to run Elisp scripts using Emacs as the engine but without launching the Emacs GUI (not even its terminal-based one). In this example, the **-Q** option causes Emacs to ignore your **.emacs** file to avoid any delays in executing the Elisp script (if your script relies upon something \ No newline at end of file diff --git a/sources/tech/20200128 Send email and check your calendar with Emacs.md b/sources/tech/20200128 Send email and check your calendar with Emacs.md deleted file mode 100644 index fb0183c1da..0000000000 --- a/sources/tech/20200128 Send email and check your calendar with Emacs.md +++ /dev/null @@ -1,152 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Send email and check your calendar with Emacs) -[#]: via: (https://opensource.com/article/20/1/emacs-mail-calendar) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Send email and check your calendar with Emacs -====== -Manage your email and view your schedule with the Emacs text editor in -the eighteenth in our series on 20 ways to be more productive with open -source in 2020. -![Document sending][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Doing (almost) all the things with Emacs, part 1 - -Two days ago, I shared that I use both [Vim][2] and [Emacs][3] regularly, and on days [16][4] and [17][5] of this series, I explained how to do almost everything in Vim. Now, it's time for Emacs! - -![Mail and calendar in Emacs][6] - -Before I get too far, I should explain two things. First, I'm doing everything here using the default Emacs configuration, not [Spacemacs][7], which I have [written about][8]. Why? Because I will be using the default keyboard mappings so that you can refer back to the documentation and not have to translate things from "native Emacs" to Spacemacs. Second, I'm not setting up Org mode in this series. Org mode almost needs an entire series on its own, and, while it is very powerful, the setup can be quite complex. - -#### Configure Emacs - -Configuring Emacs is a little bit more complicated than configuring Vim, but in my opinion, it is worth it in the long run. Start by creating a configuration file and opening it in Emacs: - - -``` -mkdir ~/.emacs.d -emacs ~/.emacs.d/init.el -``` - -Next, add some additional package sources to the built-in package manager. Add the following to **init.el**: - - -``` -(package-initialize) -(add-to-list 'package-archives '("melpa" . "")) -(add-to-list 'package-archives '("org" . "") t) -(add-to-list 'package-archives '("gnu" . "")) -(package-refresh-contents) -``` - -Save the file with **Ctrl**+**x** **Ctrl**+**s**, exit with **Ctrl**+**x** **Ctrl**+**c**, and restart Emacs. It will download all the package lists at startup, and then you should be ready to install things with the built-in package manager. Start by typing **Meta**+**x** to bring up a command prompt (the **Meta** key is the **Alt** key on most keyboards or **Option** on MacOS). At the command prompt, type **package-list-packages** to bring up a list of packages you can install. Go through the list and select the following packages with the **i** key: - - -``` -bbdb -bbdb-vcard -calfw -calfw-ical -notmuch -``` - -Once the packages are selected, press **x** to install them. Depending on your internet connection, this could take a while. You may see some compile errors, but it's safe to ignore them. Once it completes, open **~/.emacs.d/init.el** with the key combination **Ctrl**+**x** **Ctrl**+**f**, and add the following lines to the file after **(package-refresh-packages)** and before **(custom-set-variables**. Emacs uses the **(custom-set-variables** line internally, and you should never, ever modify anything below it. Lines beginning with **;;** are comments. - - -``` -;; Set up bbdb -(require 'bbdb) -(bbdb-initialize 'message) -(bbdb-insinuate-message) -(add-hook 'message-setup-hook 'bbdb-insinuate-mail) -;; set up calendar -(require 'calfw) -(require 'calfw-ical) -;; Set this to the URL of your calendar. Google users will use -;; the Secret Address in iCalendar Format from the calendar settings -(cfw:open-ical-calendar "") -;; Set up notmuch -(require 'notmuch) -;; set up mail sending using sendmail -(setq send-mail-function (quote sendmail-send-it)) -(setq user-mail-address "[myemail@mydomain.com][9]" -      user-full-name "My Name") -``` - -Now you are ready to start Emacs with your setup! Save the **init.el** file (**Ctrl**+**x** **Ctrl**+**s**), exit Emacs (**Ctrl**+**x** **Ctrl**+**c**), and then restart it. It will take a little longer to start this time. - -#### Read and write email in Emacs with Notmuch - -Once you are at the Emacs splash screen, you can start reading your email with [Notmuch][10]. Type **Meta**+**x notmuch**, and you'll get Notmuch's Emacs interface. - -![Reading mail with Notmuch][11] - -All the items in bold type are links to email views. You can access them with either a mouse click or by tabbing between them and pressing **Return** or **Enter**. You can use the search bar to - -search Notmuch's database using the [same syntax][12] as you use on Notmuch's command line. If you want, you can save any searches for later use with the **[save]** button, and they will be added to the list at the top of the screen. If you follow one of the links, you will get a list of the relevant email messages. You can navigate the list with the **Arrow** keys, and press **Enter** on the message you want to read. Pressing **r** will reply to a message, **f** will forward the message, and **q** will exit the current screen. - -You can write a new message by typing **Meta**+**x compose-mail**. Composing, replying, and forwarding all bring up the mail writing interface. When you are done writing your email, press **Ctrl**+**c Ctrl**+**c** to send it. If you decide you don't want to send it, press **Ctrl**+**c Ctrl**+**k** to kill the message compose buffer (window). - -#### Autocomplete email addresses in Emacs with BBDB - -![Composing a message with BBDB addressing][13] - -But what about your address book? That's where [BBDB][14] comes in. But first, import all your addresses from [abook][15] by opening a command line and running the following export command: - - -``` -`abook --convert --outformat vcard --outfile ~/all-my-addresses.vcf --infile ~/.abook/addresses` -``` - -Once Emacs starts, run **Meta**+**x bbdb-vcard-import-file**. It will prompt you for the file name you want to import, which is **~/all-my-addresses.vcf**. After the import finishes, when you compose a message, you can start typing a name and use **Tab** to search and autocomplete the "To" field. BBDB will also open a buffer for the contact so you can make sure it's the correct one. - -Why do it this way when you already have each address as a **vcf.** file from [vdirsyncer][16]? If you are like me, you have a LOT of addresses, and doing them one at a time is a lot of work. This way, you can take everything you have in abook and make one big file. - -#### View your calendar in Emacs with calfw - -![calfw calendar][17] - -Finally, you can use Emacs to look at your calendar. In the configuration section above, you installed the [calfw][18] package and added lines to tell it where to find the calendars to load. Calfw is short for the Calendar Framework for Emacs, and it supports many calendar formats. Since I use Google calendar, that is the link I put into my config. Your calendar will auto-load at startup, and you can view it by switching the **cfw-calendar** buffer with the **Ctrl**+**x**+**b** command. - -Calfw offers views by the day, week, two weeks, and month. You can select the view from the top of the calendar and navigate your calendar with the **Arrow** keys. Unfortunately, calfw can only view calendars, so you'll still need to use something like [khal][19] or a web interface to add, delete, and modify events. - -So there you have it: mail, calendars, and addresses in Emacs. Tomorrow I'll do even more. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/emacs-mail-calendar - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ (Document sending) -[2]: https://www.vim.org/ -[3]: https://www.gnu.org/software/emacs/ -[4]: https://opensource.com/article/20/1/vim-email-calendar -[5]: https://opensource.com/article/20/1/vim-task-list-reddit-twitter -[6]: https://opensource.com/sites/default/files/uploads/productivity_18-1.png (Mail and calendar in Emacs) -[7]: https://www.spacemacs.org/ -[8]: https://opensource.com/article/19/12/spacemacs -[9]: mailto:myemail@mydomain.com -[10]: https://notmuchmail.org/ -[11]: https://opensource.com/sites/default/files/uploads/productivity_18-2.png (Reading mail with Notmuch) -[12]: https://opensource.com/article/20/1/organize-email-notmuch -[13]: https://opensource.com/sites/default/files/uploads/productivity_18-3.png (Composing a message with BBDB addressing) -[14]: https://www.jwz.org/bbdb/ -[15]: https://opensource.com/article/20/1/sync-contacts-locally -[16]: https://opensource.com/article/20/1/open-source-calendar -[17]: https://opensource.com/sites/default/files/uploads/productivity_18-4.png (calfw calendar) -[18]: https://github.com/kiwanami/emacs-calfw -[19]: https://khal.readthedocs.io/en/v0.9.2/index.html diff --git a/translated/tech/20200128 Send email and check your calendar with Emacs.md b/translated/tech/20200128 Send email and check your calendar with Emacs.md new file mode 100644 index 0000000000..cb5fff0849 --- /dev/null +++ b/translated/tech/20200128 Send email and check your calendar with Emacs.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Send email and check your calendar with Emacs) +[#]: via: (https://opensource.com/article/20/1/emacs-mail-calendar) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Emacs 发送电子邮件和检查日历 +====== +使用 Emacs 文本编辑器管理电子邮件和查看日程安排,这是本系列文章 (2020 年使用开放源码提高生产力的 20 种方法)的第十八篇,。 + +![Document sending][1] + +去年,我给你们带来了 2019 年的 19 天新生产力工具系列。今年,我将采取一种不同的方式:建立一个新的环境,让你使用已用或未用的工具来在新的一年里变得更有效率。 + +### 使用 Emacs 做(几乎)所有的事情,第 1 部分 + +两天前,我曾经说过我经常使用 [Vim][2] 和 [Emacs][3],在本系列的 [16][4] 和 [17][5] 天,我讲解了如何在 Vim 中做几乎所有的事情。现在,Emacs 的时间到了! + +[Emacs 中的邮件和日历 ][6] + +在深入之前,我需要说明两件事。首先,我这里使用默认的 Emacs 配置,而不是我之前[写过 ][8] 的 [Spacemacs][7]。为什么呢?因为这样一来我使用的就是默认快捷键,从而使你可以参考文档,而不必将“本机 Emacs” 转换为 Spacemacs。第二,在本系列文章中我没有对 Org 模式进行任何设置。Org 模式本身几乎可以自成一个完整的系列,它非常强大,但是设置可能非常复杂。 + +#### 配置 Emacs + +配置 Emacs 比配置 Vim 稍微复杂一些,但以我之见,从长远来看,这样做是值得的。首先我们创建一个配置文件,并在 Emacs 中打开它: + + +``` +mkdir ~/.emacs.d +emacs ~/.emacs.d/init.el +``` + +Next,add some additional package sources to the built-in package manager。Add the following to **init.el**: +接下来,向内置的包管理器添加一些额外的包源。在 **init.el** 中添加以下内容: + + +``` +(package-initialize) +(add-to-list 'package-archives '("melpa" . "")) +(add-to-list 'package-archives '("org" . "") t) +(add-to-list 'package-archives '("gnu" . "")) +(package-refresh-contents) +``` + +使用 `Ctrl+x Ctrl+s` 保存文件,然后按下 `Ctrl+x Ctrl+c` 退出,再重启 Emacs。Emacs 会在启动时下载所有的插件包列表,之后你就可以使用内置的包管理器安装插件了。 +输入 `Meta+x` 会弹出命令提示符(大多数键盘上 **Meta** 键就是的 **Alt** 键,而在 MacOS 上则是 **Option**)。在命令提示符下输入 **package-list-packages** 就会显示可以安装的包列表。遍历该列表并使用 **i** 键选择以下包: + + +``` +bbdb +bbdb-vcard +calfw +calfw-ical +notmuch +``` + +选好软件包后按 **x** 安装它们。根据你的网络连接情况,这可能需要一段时间。你也许会看到一些编译错误,但是可以忽略它们。 +安装完成后,使用组合键 `Ctrl+x Ctrl+f` 打开 `~/.emacs.d/init.el`,并在 `(package-refresh-packages)` 之后 `(custom-set-variables` 之前添加以下行到文件中。 +`(custom-set-variables` 行由 Emacs 内部维护,你永远不应该修改它之后的任何内容。以**;;**开头的行则是注释。 + + +``` +;; Set up bbdb +(require 'bbdb) +(bbdb-initialize 'message) +(bbdb-insinuate-message) +(add-hook 'message-setup-hook 'bbdb-insinuate-mail) +;; set up calendar +(require 'calfw) +(require 'calfw-ical) +;; Set this to the URL of your calendar. Google users will use +;; the Secret Address in iCalendar Format from the calendar settings +(cfw:open-ical-calendar "") +;; Set up notmuch +(require 'notmuch) +;; set up mail sending using sendmail +(setq send-mail-function (quote sendmail-send-it)) +(setq user-mail-address "[myemail@mydomain.com][9]" +      user-full-name "My Name") +``` + +现在,您已经准备好使用自己的配置启动 Emacs 了!保存 `init.el` 文件 (`Ctrl+x Ctrl+s`),退出 Emacs(`Ctrl+x Ctrl+c`),然后重启之。这次重启要多花些时间。 + +#### 使用 Notmuch 在 Emacs 中读写电子邮件 + +一旦你看到了 Emacs 启动屏幕,你就可以使用 [Notmuch][10] 来阅读电子邮件了。键入 `Meta+x notmuch`,您将看到 notmuch 的 Emacs 接口。 + +![使用 notmuch 阅读邮件 ][11] + +所有加粗的项目都是指向电子邮件视图的链接。你可以通过点击鼠标或者使用 tab 键在它们之间跳转并按 **Return** 或 **Enter** 来访问它们。你可以使用搜索栏来搜索 Notmuch 的数据库,语法与 Notmuch 命令行上的[语法 ][12] 相同。如果你愿意,还可以使用 **[save]** 按钮保存搜索以便未来使用,这些搜索会被添加到屏幕顶部的列表中。如果你进入一个链接就会看到一个相关电子邮件的列表。您可以使用**箭头**键在列表中导航,并在要读取的消息上按 **Enter**。按 **r** 可以回复一条消息,**f** 转发该消息,**q** 退出当前屏幕。 + +You can write a new message by typing **Meta**+**x compose-mail**。Composing,replying,and forwarding all bring up the mail writing interface。When you are done writing your email,press **Ctrl**+**c Ctrl**+**c** to send it。If you decide you don't want to send it,press **Ctrl**+**c Ctrl**+**k** to kill the message compose buffer (window)。 +您可以通过键入 `Meta+x compose-mail` 来编写新消息。撰写、回复和转发都将打开编写邮件的接口。写完邮件后,按 `Ctrl+c Ctrl+c` 发送。如果你决定不发送它,按 `Ctrl+c Ctrl+k` 关闭消息撰写缓冲区(窗口)。 + +#### 使用 BBDB 在 Emacs 中自动补完电子邮件地址 + +[在消息中使用 BBDB 地址 ][13] + +那么通讯录怎么办?这就是 [BBDB][14] 发挥作用的地方。但首先我们需要从 [abook][15] 导入所有地址,方法是打开命令行并运行以下导出命令: + + +``` +`abook --convert --outformat vcard --outfile ~/all-my-addresses.vcf --infile ~/.abook/addresses` +``` + +Emacs 启动后,运行 `Meta+x bbdb-vcard-import-file`。它将提示你输入要导入的文件名,即 `~/all-my-address.vcf`。导入完成后,在编写消息时,可以开始输入名称并使用 **Tab** 搜索和自动完成 “to” 字段的内容。BBDB 还会打开一个联系人缓冲区,以便你确保它是正确的。 + +既然在 [vdirsyncer][16] 中已经为每个地址都生成了对应的 vcf。文件了,为什么我们还要这样做呢?如果你像我一样,有许多地址,一次处理一个地址是很麻烦的。这样做,你就可以把所有的东西都放在一本书里,做成一个大文件。 + +#### 使用 calfw 在 Emacs 中浏览日历 + +![calfw 日历 ][17] + +最后,你可以使用 Emacs 查看日历。在上面的配置中,你安装了 [calfw][18] 包,并添加了一些行来告诉它在哪里可以找到要加载的日历。Calfw 是 Emacs 日历框架的简称,它支持多种日历格式。我使用的是谷歌日历,这也是我放在配置中的链接。日历将在启动时自动加载,您可以通过 `Ctrl+x+b` 命令切换到 **cfw-calendar** 缓冲区来查看日历。 + +Calfw 提供日、周、双周和月视图。您可以在日历顶部选择视图,并使用**箭头**键导航日历。不幸的是,calfw 只能查看日历,所以您仍然需要使用 [khal][19] 之类的工具或通过 web 界面来添加、删除和修改事件。 + +这就是 Emacs 中的邮件、日历和邮件地址。明天我会展示更多。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/emacs-mail-calendar + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ (Document sending) +[2]: https://www.vim.org/ +[3]: https://www.gnu.org/software/emacs/ +[4]: https://opensource.com/article/20/1/vim-email-calendar +[5]: https://opensource.com/article/20/1/vim-task-list-reddit-twitter +[6]: https://opensource.com/sites/default/files/uploads/productivity_18-1.png (Mail and calendar in Emacs) +[7]: https://www.spacemacs.org/ +[8]: https://opensource.com/article/19/12/spacemacs +[9]: mailto:myemail@mydomain.com +[10]: https://notmuchmail.org/ +[11]: https://opensource.com/sites/default/files/uploads/productivity_18-2.png (Reading mail with Notmuch) +[12]: https://opensource.com/article/20/1/organize-email-notmuch +[13]: https://opensource.com/sites/default/files/uploads/productivity_18-3.png (Composing a message with BBDB addressing) +[14]: https://www.jwz.org/bbdb/ +[15]: https://opensource.com/article/20/1/sync-contacts-locally +[16]: https://opensource.com/article/20/1/open-source-calendar +[17]: https://opensource.com/sites/default/files/uploads/productivity_18-4.png (calfw calendar) +[18]: https://github.com/kiwanami/emacs-calfw +[19]: https://khal.readthedocs.io/en/v0.9.2/index.html From e85c77a9b7ed1a76b026419e6fcf6bdc19423649 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Feb 2020 22:02:39 +0800 Subject: [PATCH 064/260] revert --- ...6 things you should be doing with Emacs.md | 53 +++---------------- 1 file changed, 7 insertions(+), 46 deletions(-) diff --git a/sources/tech/20200123 6 things you should be doing with Emacs.md b/sources/tech/20200123 6 things you should be doing with Emacs.md index 059cd4b18e..b01830cd8e 100644 --- a/sources/tech/20200123 6 things you should be doing with Emacs.md +++ b/sources/tech/20200123 6 things you should be doing with Emacs.md @@ -8,123 +8,84 @@ [#]: author: (Seth Kenlon https://opensource.com/users/seth) 6 things you should be doing with Emacs -你应该用Emacs做的6件事 ====== Here are six things you may not have realized you could do with Emacs. -下面是您可能没有意识到的Emacs可以做的六件事。 Then, get our new cheat sheet to get the most out of Emacs. -然后,使用我们的新备忘单来充分利用Emacs。 ![Text editor on a browser, in blue][1] -[在蓝色浏览器上给编辑发短信][1] Imagine using Python's IDLE interface to edit text. You would be able to load files into memory, edit them, and save changes. But every action you perform would be defined by a Python function. Making a word all capitals, for instance, calls **upper()**, opening a file calls **open**, and so on. Everything in your text document is a Python object and can be manipulated accordingly. From the user's perspective, it's the same experience as any text editor. For a Python developer, it's a rich Python environment that can be changed and developed with just a few custom functions in a config file. -想象一下使用Python的空闲接口来编辑文本。您可以将文件加载到内存中,编辑它们,并保存更改。但是您执行的每个操作都将由Python函数定义。例如,使一个单词全部大写,调用**upper()**,打开一个文件调用**open**,等等。文本文档中的所有内容都是Python对象,可以相应地进行操作。从用户的角度来看,这与任何文本编辑器的体验都是一样的。对于Python开发人员来说,这是一个丰富的Python环境,只需在配置文件中添加几个自定义函数就可以对其进行更改和开发。 This is what [Emacs][2] does for the 1958 programming language [Lisp][3]. In Emacs, there's no separation between the Lisp engine running the application and the arbitrary text you type into it. To Emacs, everything is Lisp data, so everything can be analyzed and manipulated programmatically. -这就是[Emacs][2]对1958年的编程语言[Lisp][3]所做的。在Emacs中,运行应用程序的Lisp引擎与您输入的任意文本之间没有分离。对于Emacs,一切都是Lisp数据,因此一切都可以通过编程进行分析和操作。 That makes for a powerful user interface (UI). But if you're a casual Emacs user, you may only be scratching the surface of what it can do for you. Here are six things you may not have realized you could do with Emacs. -这就形成了一个强大的用户界面(UI)。但是,如果您是Emacs的普通用户,您可能只了解它能为您做些什么。下面是您可能没有意识到的Emacs可以做的六件事。 ## Use Tramp mode for cloud editing -使用流浪汉模式进行克劳德编辑 Emacs has been network-transparent for a lot longer than has been trendy, and today it still provides one of the smoothest remote editor experiences available. The [Tramp mode][4] in Emacs (formerly known as RPC mode) stands for "Transparent Remote (file) Access, Multiple Protocol," which spells out exactly what it offers: easy access to remote files you want to edit over most popular network protocols. The most popular and safest protocol for remote editing these days is [OpenSSH][5], so that's the default. -Emacs实现网络透明的时间要比流行的时间长得多,而且时至今日,它仍然提供最流畅的远程编辑体验。Emacs中的[Tramp模式][4](以前称为RPC模式)代表“透明的远程(文件)访问,多协议”,它详细说明了它提供的功能:通过最流行的网络协议轻松访问您希望编辑的远程文件。目前最流行、最安全的远程编辑协议是[OpenSSH][5],因此它是默认的。 Tramp is already included in Emacs 22.1 or greater, so to use Tramp, you just open a file in the Tramp syntax. In the **File** menu of Emacs, select **Open File**. When prompted in the mini-buffer at the bottom of the Emacs window, enter the file name using this syntax: -在Emacs 22.1或更高版本中已经包含了Tramp,因此要使用Tramp,只需在Tramp语法中打开一个文件。在Emacs的**File**菜单中,选择**Open File**。当在Emacs窗口底部的小缓冲区中出现提示时,使用以下语法输入文件名: ``` -引用---------------------------------------------------- `/ssh:user@example.com:/path/to/file` ``` If you are required to log in interactively, Tramp prompts you for your password. However, Tramp uses OpenSSH directly, so to avoid interactive prompts, you can also add your hostname, username, and SSH key path to your **~/.ssh/config** file. Like Git, Emacs uses your SSH config first and only stops to ask for more information in the event of an error. -如果需要交互式登录,Tramp会提示您输入密码。但是,Tramp直接使用OpenSSH,所以为了避免交互提示,您还可以将您的主机名、用户名和SSH密钥路径添加到您的**~/。ssh / config文件* *。与Git一样,Emacs首先使用SSH配置,只有在出现错误时才会停下来询问更多信息。 Tramp is great for editing files that don't exist on your computer, and the user experience is not noticeably any different from editing a local file. The next time you start to SSH into a server just to launch a Vim or Emacs session, try Tramp instead. -Tramp非常适合编辑计算机上不存在的文件,用户体验与编辑本地文件没有明显的区别。下一次,当您为了启动Vim或Emacs会话而开始SSH到服务器时,请尝试使用Tramp。 ## Calendaring -# Calendaring If you parse text better than you parse graphical interfaces, you'll be happy to know that you can schedule your day (or life) in plain text with Emacs but still get fancy notifications on your mobile device with open source [Org mode][6] viewers. -如果您解析文本比解析图形界面更好,那么您会很高兴地知道,您可以使用Emacs以纯文本方式安排您的一天(或生活),但仍然可以在您的移动设备上使用开放源码[Org模式][6]查看器获得花哨的通知。 The process takes a little setup to create a convenient way to sync your agenda with your mobile device (I use Git, but you could invoke Bluetooth, KDE Connect, Nextcloud, or your file synchronization tool of choice), and you have to install an Org mode viewer (such as [Orgzly][7]) and a Git client app on your mobile. Once you've got your infrastructure sorted, though, the process is inherently perfectly integrated with your usual (or developing, if you're a new user) Emacs workflow. You can refer to your agenda easily in Emacs, make updates to your schedule, and generally stay on task. Pushing changes to your agenda is reflected on your mobile, so you can stay organized even when Emacs isn't available. -这个过程需要一些设置创建一个方便的方式来移动设备同步你的议程(我使用Git,但你可以调用蓝牙,KDE连接,Nextcloud,或您的文件同步工具的选择),你必须安装一个组织模式查看器(如[Orgzly][7])和一个Git客户对你的移动应用程序。但是,一旦您对基础设施进行了排序,该流程就会与您通常使用的Emacs工作流完美地集成在一起(如果您是新用户,则会进行开发)。您可以在Emacs中方便地查阅您的日程,更新您的日程,并通常停留在任务上。推动您的议程的变化反映在您的移动设备上,因此即使Emacs不可用,您也可以保持组织性。 ![][8] Intrigued? Read my step-by-step guide about [calendaring with Org mode and Git][9]. -感兴趣吗?阅读我的关于[使用Org模式和Git进行日历][9]的逐步指南。 ## Access the terminal -访问终端 There are [lots of terminal emulators][10] available. Although the Elisp terminal emulator in Emacs isn't the greatest general-purpose one, it's got two notable advantages. -有[许多终端模拟器][10]可用。尽管Emacs中的Elisp终端仿真器不是最强大的通用仿真器,但是它有两个显著的优点。 -1. **Opens in an Emacs buffer: **I use Emacs' Elisp shell because it's conveniently located in my Emacs window, which I often run in fullscreen. It's a small but significant advantage to have a terminal just a **Ctrl+x+o** (or C-x o in Emacs notation) away, and it's especially nice to be able to glance over at it for status reports when it's running a lengthy job. -1. 我使用Emacs的Elisp shell,因为它方便地位于我的Emacs窗口,我经常在全屏运行。这是一个小但重要的优势,有一个终端只是**Ctrl+x+o**(或C-x o在Emacs符号),它是特别好的,能够浏览它的状态报告,当它运行一个漫长的作业。 -2. **Easy copying and pasting if no system clipboard is available:** Whether I'm too lazy to move my hand from the keys to the mouse, or I don't have mouse functionality because I'm running Emacs in a remote console, having a terminal in Emacs can sometimes mean a quick transfer of data from my Emacs buffer to Bash. -2. * *简单的复制和粘贴,如果没有可用系统剪贴板:* *是否我太懒惰的关键将我的手从鼠标,或者我没有鼠标功能,因为我在远程控制台运行Emacs,在Emacs有时意味着终端快速传输数据从我的Emacs缓冲Bash。 + 1. **Opens in an Emacs buffer: **I use Emacs' Elisp shell because it's conveniently located in my Emacs window, which I often run in fullscreen. It's a small but significant advantage to have a terminal just a **Ctrl+x+o** (or C-x o in Emacs notation) away, and it's especially nice to be able to glance over at it for status reports when it's running a lengthy job. + 2. **Easy copying and pasting if no system clipboard is available:** Whether I'm too lazy to move my hand from the keys to the mouse, or I don't have mouse functionality because I'm running Emacs in a remote console, having a terminal in Emacs can sometimes mean a quick transfer of data from my Emacs buffer to Bash. To try the Emacs terminal, type **Alt**+**x** (**M-x** in Emacs notation), then type **shell**, and press **Return**. -要尝试Emacs终端,输入**Alt**+**x** (Emacs符号中的**M-x**),然后输入**shell**,然后按**Return**。 ## Use Racket mode -使用球拍模式 [Racket][11] is an exciting emerging Lisp dialect with a dynamic programming environment, a GUI toolkit, and a passionate community. The default editor when learning Racket is DrRacket, which has a Definitions panel at the top and an Interactions panel at the bottom. Using this setup, the user writes definitions that affect the Racket runtime. Imagine the old [Logo Turtle][12] program, but with a terminal instead of just a turtle. -[11]是一种激动人心的新兴Lisp语言,拥有动态编程环境、GUI工具包和热情的社区。学习球拍的默认编辑器是dr球拍,它的顶部有一个定义面板,底部有一个交互面板。使用此设置,用户可以编写影响球拍运行时的定义。想象一下旧的[Logo Turtle][12]程序,但是有一个终端而不是一个Turtle。 ![Racket-mode][13] -[Racket-mode] [13] ! LGPL sample code by PLT -由PLT提供的LGPL示例代码 Emacs, being based on Lisp, makes a great integrated development environment (IDE) for advanced Racket coders. It doesn't ship with [Racket mode][14] (yet), but you can install Racket mode and several other helper extensions using the Emacs package installer. To install it, press **Alt**+**X** (**M-x** in Emacs notation), type **package-install**, and press **Return**. Then enter the package you want to install (**racket-mode**), and press **Return**. -基于Lisp的Emacs为高级球拍编程人员提供了一个很好的集成开发环境(IDE)。它还没有[球拍模式][14],但你可以安装球拍模式和其他几个助手扩展使用Emacs包安装程序。要安装它,按**Alt**+**X** (**M-x** Emacs符号),键入**package-install**,然后按**Return**。然后输入要安装的包(**rac模式**),按**Return**。 Enter Racket mode with **M-x racket-mode**. If you're new to Racket but not to Lisp or Emacs, start with the excellent [Quick introduction to Racket with pictures][15]. -进入球拍模式,使用**M-x球拍模式**。如果你是球拍新手,但不是口齿不清或Emacs,开始优秀[快速介绍球拍与图片][15]。 ## Scripting -# # Scripting You might know that Bash scripts are popular for automating and enhancing your Linux or Unix experience. You may have heard that Python does a pretty good job of that, too. But did you know that Lisp scripts can be run in much the same way? There's sometimes confusion about just how useful Lisp really is because many people are introduced to Lisp through Emacs, so there's the latent impression that the only way to run Lisp in the 21st century is to open an Emacs window. Luckily, that's not the case at all, and Emacs is a great IDE for the tools that enable you to run Lisp scripts as general system executables. -您可能知道,Bash脚本在自动化和增强您的Linux或Unix体验方面很流行。您可能听说过Python在这方面也做得很好。但是你知道Lisp脚本可以用同样的方式运行吗?有时人们会对Lisp到底有多有用感到困惑,因为许多人是通过Emacs来了解Lisp的,因此有一种潜在的印象,即在21世纪运行Lisp的惟一方法是打开Emacs窗口。幸运的是,事实并非如此,Emacs是一个很好的IDE,它支持将Lisp脚本作为一般的系统可执行文件来运行。 There are two popular modern Lisps, aside from Elisp, that are easy to run as standalone scripts. -除了Elisp之外,有两种流行的现代lisp很容易作为独立脚本运行。 -1. **Racket:** You can run Racket scripts relying on your system's Racket install to provide runtime support, or you can use **raco exe** to produce an executable. The **raco exe** command packages your code together with runtime support files to create an executable. The **raco distribute** command then packages that executable into a distribution that works on other machines. Emacs has many Racket-specific tools, so creating Racket files in Emacs is easy and efficient. -1. **球拍:**你可以运行球拍脚本依赖于你的系统的球拍安装提供运行时支持,或者你可以使用**raco exe**产生一个可执行文件。**raco exe**命令将代码和运行时支持文件打包,以创建可执行文件。然后,**raco distribution **命令将可执行文件打包到在其他机器上工作的发行版中。Emacs有许多特定于球拍的工具,因此在Emacs中创建球拍文件既简单又有效。 + 1. **Racket:** You can run Racket scripts relying on your system's Racket install to provide runtime support, or you can use **raco exe** to produce an executable. The **raco exe** command packages your code together with runtime support files to create an executable. The **raco distribute** command then packages that executable into a distribution that works on other machines. Emacs has many Racket-specific tools, so creating Racket files in Emacs is easy and efficient. -2. **GNU Guile:** [GNU Guile][16] (short for "GNU Ubiquitous Intelligent Language for Extensions") is an implementation of the [Scheme][17] programming language that's used for creating applications and games for the desktop, internet, terminal, and more. Writing Scheme is easy, using any one of the many Scheme extensions in Emacs. For example, here's a "Hello world" script in Guile: [code] #!/usr/bin/guile -s -2. **GNU Guile:** [GNU Guile][16](“GNU通用智能语言扩展”的缩写)是[Scheme][17]编程语言的一个实现,它用于为桌面、internet、终端等创建应用程序和游戏。使用Emacs中众多Scheme扩展中的任何一个,编写Scheme都很容易。例如,这里有一个用Guile编写的“Hello world”脚本:[code] #!/usr/bin/guile - s + 2. **GNU Guile:** [GNU Guile][16] (short for "GNU Ubiquitous Intelligent Language for Extensions") is an implementation of the [Scheme][17] programming language that's used for creating applications and games for the desktop, internet, terminal, and more. Writing Scheme is easy, using any one of the many Scheme extensions in Emacs. For example, here's a "Hello world" script in Guile: [code] #!/usr/bin/guile -s !# (display "hello world") -(显示“hello world”)      (newline) [/code] Compile and run it with the **guile** command: [code] $ guile ./hello.scheme -(换行)[/code]编译并运行**guile**命令:[code] $ guile ./hello.scheme ;;; compiling /home/seth/./hello.scheme -;;;compiling / home /塞斯-你好。怀廷 ;;; compiled [...]/hello.scheme.go -;;;[…]/ hello.scheme.go编译 hello world -你好,世界 $ guile ./hello.scheme -你好,scheme -hello world -你好,世界 +hello world ``` -引用---------------------------------------------------- ## Run Elisp without Emacs + +Emacs can serve as an Elisp runtime, but you don't have to "open" Emacs in the traditional sense. The **\--script** option allows you to run Elisp scripts using Emacs as the engine but without launching the Emacs GUI (not even its terminal-based one). In this example, the **-Q** option causes Emacs to ignore your **.emacs** file to avoid any delays in executing the Elisp script (if your script relies upon something \ No newline at end of file From 3dd212a7ccdbee49029d7d3a5df945933ace2a30 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Feb 2020 22:06:52 +0800 Subject: [PATCH 065/260] translating by lujun9972 --- ...200129 Use Emacs to get social and track your todo list.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200129 Use Emacs to get social and track your todo list.md b/sources/tech/20200129 Use Emacs to get social and track your todo list.md index 3893aac377..097f1919a3 100644 --- a/sources/tech/20200129 Use Emacs to get social and track your todo list.md +++ b/sources/tech/20200129 Use Emacs to get social and track your todo list.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lujun9972) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -132,7 +132,7 @@ via: https://opensource.com/article/20/1/emacs-social-track-todo-list 作者:[Kevin Sonney][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lujun9972](https://github.com/lujun9972) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 20796c61d4e8420b81936790216cdc0cf781ea20 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 25 Feb 2020 00:58:37 +0800 Subject: [PATCH 066/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200224=20Make?= =?UTF-8?q?=20free=20encrypted=20backups=20to=20the=20cloud=20on=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200224 Make free encrypted backups to the cloud on Fedora.md --- ...ncrypted backups to the cloud on Fedora.md | 237 ++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 sources/tech/20200224 Make free encrypted backups to the cloud on Fedora.md diff --git a/sources/tech/20200224 Make free encrypted backups to the cloud on Fedora.md b/sources/tech/20200224 Make free encrypted backups to the cloud on Fedora.md new file mode 100644 index 0000000000..6015e6dc92 --- /dev/null +++ b/sources/tech/20200224 Make free encrypted backups to the cloud on Fedora.md @@ -0,0 +1,237 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Make free encrypted backups to the cloud on Fedora) +[#]: via: (https://fedoramagazine.org/make-free-encrypted-backups-to-the-cloud-on-fedora/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +Make free encrypted backups to the cloud on Fedora +====== + +![][1] + +Most free cloud storage is limited to 5GB or less. Even Google Drive is limited to 15GB. While not heavily advertised, IBM offers free accounts with a whopping **25GB** of cloud storage for free. This is not a limited time offer, and you don’t have to provide a credit card. It’s absolutely free! Better yet, since it’s S3 compatible, most of the S3 tools available for backups should work fine. + +This article will show you how to use restic for encrypted backups onto this free storage. Please also refer to [this previous Magazine article about installing and configuring restic.][2] Let’s get started! + +### Creating your free IBM account and storage + +Head over to the IBM cloud services site and follow the steps to sign up for a free account here: . You’ll need to verify your account from the email confirmation that IBM sends to you. + +Then log in to your account to bring up your dashboard, at . + +Click on the **Create resource** button. + +![][3] + +Click on **Storage** and then **Object Storage**. + +![][4] + +Next click on the **Create Bucket** button. + +![][5] + +This brings up the **Configure your resource** section. + +![][6] + +Next, click on the ****Create** button to use the default settings. + +![][7] + +Under **Predefined buckets** click on the **Standard** box: + +![][8] + +A unique bucket name is automatically created, but it’s suggested that you change this. + +![][9] + +In this example, the bucket name is changed to __freecloudstorage_._** + +Click on the **Next** button after choosing a bucket name: + +![][10] + +Continue to click on the **Next** button until you get the the **Summary** page: + +![][11] + +Scroll down to the **Endpoints** section. + +![][12] + +The information in the **Public** section is the location of your bucket. This is what you need to specify in restic when you create your backups. In this example, the location is **s3.us-south.cloud-object-storage.appdomain.cloud**. + +### Making your credentials + +The last thing that you need to do is create an access ID and secret key. To start, click on **Service credentials**. + +![][13] + +Click on the **New credential** button. + +![][14] + +Choose a name for your credential, make sure you check the **Include HMAC Credential** box and then click on the **Add** button. In this example I’m using the name **resticbackup**. + +![][15] + +Click on **View credentials**. + +![][16] + +The _access_key_id_ and _secret_access_key_ is what you are looking for. (For obvious reasons, the author’s details here are obscured.) + +You will need to export these by calling them with the _export_ alias in the shell, or putting them into a backup script. + +![][17] + +### Preparing a new repository + +Restic refers to your backup as a _repository_, and can make backups to any bucket on your IBM cloud account. First, setup the following environment variables using your _access_key_id_ and _secret_access_key_ that you retrieved from your IBM cloud bucket. These can also be set in any backup script you may create. + +``` +$ export AWS_ACCESS_KEY_ID= +$ export AWS_SECRET_ACCESS_KEY= +``` + +Even though you are using IBM Cloud and not AWS, as previously mentioned, IBM Cloud storage is S3 compatible, and restic uses its interal AWS commands for any S3 compatible storage. So these AWS keys really refer to the keys from your IBM bucket. + +Create the repository by initializing it. A prompt appears for you to type a password for the repository. _**Do not lose this password because your data is irrecoverable without it!**_ + +``` +restic -r s3:http://PUBLIC_ENDPOINT_LOCATION/BUCKET init +``` + +The _PUBLIC_ENDPOINT_LOCATION_ was specified in the Endpoint section of your Bucket summary. + +![][18] + +For example: + +``` +$ restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage init +``` + +### Creating backups + +Now it’s time to backup some data. Backups are called _snapshots_. Run the following command and enter the repository password when prompted. + +``` +restic -r s3:http://PUBLIC_ENDPOINT_LOCATION/BUCKET backup files_to_backup +``` + +For example: + +``` +$ restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage backup Documents/ +Enter password for repository: + repository 106a2eb4 opened successfully, password is correct + Files: 51 new, 0 changed, 0 unmodified + Dirs: 0 new, 0 changed, 0 unmodified + Added to the repo: 11.451 MiB + processed 51 files, 11.451 MiB in 0:06 + snapshot 611e9577 saved +``` + +### Restoring from backups + +Now that you’ve backed up some files, it’s time to make sure you know how to restore them. To get a list of all of your backup snapshots, use this command: + +``` +restic -r s3:http://PUBLIC_ENDPOINT_LOCATION/BUCKET snapshots +``` + +For example: + +``` +$ restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage snapshots +Enter password for repository: +ID Date Host Tags Directory +------------------------------------------------------------------- +106a2eb4 2020-01-15 15:20:42 client /home/curt/Documents +``` + +To restore an entire snapshot, run a command like this: + +``` +restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage restore snapshotID --target restoreDirectory +``` + +For example: + +``` +$ restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage restore 106a2eb4 --target ~ +Enter password for repository: +repository 106a2eb4 opened successfully, password is correct +restoring to /tmp +``` + +* * * + +_Photo by [Alex Machado][19] on [Unsplash][20]._ + +[EDITORS NOTE: The Fedora Project is [sponsored][21] by [Red Hat][22], which is owned by [IBM][23].] + +[EDITORS NOTE: Updated at 1647 UTC on 24 February 2020 to correct a broken link.] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/make-free-encrypted-backups-to-the-cloud-on-fedora/ + +作者:[Curt Warfield][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/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/encrypted-backups-ibm-cloud-816x345.jpg +[2]: https://fedoramagazine.org/use-restic-encrypted-backups/ +[3]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmclouddash-3-e1579713553261.png +[4]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmcloudresourcestorage-3.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmcloudbucket-3.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmcloudbucket2.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmcloudbucket3-e1579713758635.png +[8]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmcloudbucket4.png +[9]: https://fedoramagazine.org/wp-content/uploads/2020/01/createbucket1.png +[10]: https://fedoramagazine.org/wp-content/uploads/2020/01/next.png +[11]: https://fedoramagazine.org/wp-content/uploads/2020/01/bucketsummary-1024x368.png +[12]: https://fedoramagazine.org/wp-content/uploads/2020/01/endpoints-1024x272.png +[13]: https://fedoramagazine.org/wp-content/uploads/2020/01/servicecreds.png +[14]: https://fedoramagazine.org/wp-content/uploads/2020/01/newcred.png +[15]: https://fedoramagazine.org/wp-content/uploads/2020/01/addnewcred.png +[16]: https://fedoramagazine.org/wp-content/uploads/2020/01/keys-1024x298.png +[17]: https://fedoramagazine.org/wp-content/uploads/2020/01/keys2.png +[18]: https://fedoramagazine.org/wp-content/uploads/2020/01/publicendpoint.png +[19]: https://unsplash.com/@alexmachado?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[20]: https://unsplash.com/s/photos/backups-to-cloud?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[21]: https://getfedora.org/sponsors/ +[22]: https://redhat.com +[23]: https://www.ibm.com/cloud/redhat From 01b8789117cdd437dc43db00aa6a1d1b07d0f8a4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 25 Feb 2020 01:04:03 +0800 Subject: [PATCH 067/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200224=20Using?= =?UTF-8?q?=20C=20and=20C++=20for=20data=20science?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200224 Using C and C-- for data science.md --- ...200224 Using C and C-- for data science.md | 747 ++++++++++++++++++ 1 file changed, 747 insertions(+) create mode 100644 sources/tech/20200224 Using C and C-- for data science.md diff --git a/sources/tech/20200224 Using C and C-- for data science.md b/sources/tech/20200224 Using C and C-- for data science.md new file mode 100644 index 0000000000..10cdb5e59f --- /dev/null +++ b/sources/tech/20200224 Using C and C-- for data science.md @@ -0,0 +1,747 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using C and C++ for data science) +[#]: via: (https://opensource.com/article/20/2/c-data-science) +[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) + +Using C and C++ for data science +====== +Let's work through common data science task with C99 and C++11. +![metrics and data shown on a computer screen][1] + +While languages like [Python][2] and [R][3] are increasingly popular for data science, C and C++ can be a strong choice for efficient and effective data science. In this article, we will use [C99][4] and [C++11][5] to write a program that uses the [Anscombe’s quartet][6] dataset, which I'll explain about next. + +I wrote about my motivation for continually learning languages in an article covering [Python and GNU Octave][7], which is worth reviewing. All of the programs are meant to be run on the [command line][8], not with a [graphical user interface][9] (GUI). The full examples are available in the [polyglot_fit repository][10]. + +### The programming task + +The program you will write in this series: + + * Reads data from a [CSV file][11] + * Interpolates the data with a straight line (i.e., _f(x)=m ⋅ x + q_) + * Plots the result to an image file + + + +This is a common situation that many data scientists have encountered. The example data is the first set of [Anscombe's quartet][6], shown in the table below. This is a set of artificially constructed data that gives the same results when fitted with a straight line, but their plots are very different. The data file is a text file with tabs as column separators and a few lines as a header. This task will use only the first set (i.e., the first two columns). + +[**Anscombe's quartet**][6] + +I + +II + +III + +IV + +x + +y + +x + +y + +x + +y + +x + +y + +10.0 + +8.04 + +10.0 + +9.14 + +10.0 + +7.46 + +8.0 + +6.58 + +8.0 + +6.95 + +8.0 + +8.14 + +8.0 + +6.77 + +8.0 + +5.76 + +13.0 + +7.58 + +13.0 + +8.74 + +13.0 + +12.74 + +8.0 + +7.71 + +9.0 + +8.81 + +9.0 + +8.77 + +9.0 + +7.11 + +8.0 + +8.84 + +11.0 + +8.33 + +11.0 + +9.26 + +11.0 + +7.81 + +8.0 + +8.47 + +14.0 + +9.96 + +14.0 + +8.10 + +14.0 + +8.84 + +8.0 + +7.04 + +6.0 + +7.24 + +6.0 + +6.13 + +6.0 + +6.08 + +8.0 + +5.25 + +4.0 + +4.26 + +4.0 + +3.10 + +4.0 + +5.39 + +19.0 + +12.50 + +12.0 + +10.84 + +12.0 + +9.13 + +12.0 + +8.15 + +8.0 + +5.56 + +7.0 + +4.82 + +7.0 + +7.26 + +7.0 + +6.42 + +8.0 + +7.91 + +5.0 + +5.68 + +5.0 + +4.74 + +5.0 + +5.73 + +8.0 + +6.89 + +### The C way + +[C][12] is a general-purpose programming language that is among the most popular languages in use today (according to data from the [TIOBE Index][13], [RedMonk Programming Language Rankings][14], [Popularity of Programming Language Index][15], and [State of the Octoverse of GitHub][16]). It is a quite old language (circa 1973), and many successful programs were written in it (e.g., the Linux kernel and Git to name just two). It is also one of the closest languages to the inner workings of the computer, as it is used to manipulate memory directly. It is a [compiled language][17]; therefore, the source code has to be translated by a [compiler][18] into [machine code][19]. Its [standard library][20] is small and light on features, so other libraries have been developed to provide missing functionalities. + +It is the language I use the most for [number crunching][21], mostly because of its performance. I find it rather tedious to use, as it needs a lot of [boilerplate code][22], but it is well supported in various environments. The C99 standard is a recent revision that adds some nifty features and is well supported by compilers. + +I will cover the necessary background of C and C++ programming along the way so both beginners and advanced users can follow along.   + +#### Installation + +To develop with C99, you need a compiler. I normally use [Clang][23], but [GCC][24] is another valid open source compiler. For linear fitting, I chose to use the [GNU Scientific Library][25]. For plotting, I could not find any sensible library, and therefore this program relies on an external program: [Gnuplot][26]. The example also uses a dynamic data structure to store data, which is defined in the [Berkeley Software Distribution][27] (BSD). + +Installing in [Fedora][28] is as easy as running: + + +``` +`sudo dnf install clang gnuplot gsl gsl-devel` +``` + +#### Commenting code + +In C99, [comments][29] are formatted by putting **//** at the beginning of the line, and the rest of the line will be discarded by the interpreter. Alternatively, anything between **/*** and ***/** is discarded, as well. + + +``` +// This is a comment ignored by the interpreter. +/* Also this is ignored */ +``` + +#### Necessary libraries + +Libraries are composed of two parts: + + * A [header file][30] that contains a description of the functions + * A source file that contains the functions' definitions + + + +Header files are included in the source, while the libraries' sources are [linked][31] against the executable. Therefore, the header files needed for this example are: + + +``` +// Input/Output utilities +#include <stdio.h> +// The standard library +#include <stdlib.h> +// String manipulation utilities +#include <string.h> +// BSD queue +#include <sys/queue.h> +// GSL scientific utilities +#include <gsl/gsl_fit.h> +#include <gsl/gsl_statistics_double.h> +``` + +#### Main function + +In C, the program must be inside a special function called **[main()][32]:** + + +``` +int main(void) { +    ... +} +``` + +This differs from Python, as covered in the last tutorial, which will run whatever code it finds in the source files. + +#### Defining variables + +In C, variables have to be declared before they are used, and they have to be associated with a type. Whenever you want to use a variable, you have to decide what kind of data to store in it. You can also specify if you intend to use a variable as a constant value, which is not necessary, but the compiler can benefit from this information. From the [fitting_C99.c program][33] in the repository: + + +``` +const char *input_file_name = "anscombe.csv"; +const char *delimiter = "\t"; +const unsigned int skip_header = 3; +const unsigned int column_x = 0; +const unsigned int column_y = 1; +const char *output_file_name = "fit_C99.csv"; +const unsigned int N = 100; +``` + +Arrays in C are not dynamic, in the sense that their length has to be decided in advance (i.e., before compilation): + + +``` +`int data_array[1024];` +``` + +Since you normally do not know how many data points are in a file, use a [singly linked list][34]. This is a dynamic data structure that can grow indefinitely. Luckily, the BSD [provides linked lists][35]. Here is an example definition: + + +``` +struct data_point { +    double x; +    double y; + +    SLIST_ENTRY(data_point) entries; +}; + +SLIST_HEAD(data_list, data_point) head = SLIST_HEAD_INITIALIZER(head); +SLIST_INIT(&head); +``` + +This example defines a **data_point** list comprised of structured values that contain both an **x** value and a **y** value. The syntax is rather complicated but intuitive, and describing it in detail would be too wordy. + +#### Printing output + +To print on the terminal, you can use the [**printf()**][36] function, which works like Octave's **printf()** function (described in the first article): + + +``` +`printf("#### Anscombe's first set with C99 ####\n");` +``` + +The **printf()** function does not automatically add a newline at the end of the printed string, so you have to add it. The first argument is a string that can contain format information for the other arguments that can be passed to the function, such as: + + +``` +`printf("Slope: %f\n", slope);` +``` + +#### Reading data + +Now comes the hard part… There are some libraries for CSV file parsing in C, but none seemed stable or popular enough to be in the Fedora packages repository. Instead of adding a dependency for this tutorial, I decided to write this part on my own. Again, going into details would be too wordy, so I will only explain the general idea. Some lines in the source will be ignored for the sake of brevity, but you can find the complete example in the repository. + +First, open the input file: + + +``` +`FILE* input_file = fopen(input_file_name, "r");` +``` + +Then read the file line-by-line until there is an error or the file ends: + + +``` +while (![ferror][37](input_file) && ![feof][38](input_file)) { +    size_t buffer_size = 0; +    char *buffer = NULL; +    +    getline(&buffer, &buffer_size, input_file); + +    ... +} +``` + +The [**getline()**][39] function is a nice recent addition from the [POSIX.1-2008 standard][40]. It can read a whole line in a file and take care of allocating the necessary memory. Each line is then split into [tokens][41] with the [**strtok()**][42] function. Looping over the token, select the columns that you want: + + +``` +char *token = [strtok][43](buffer, delimiter); + +while (token != NULL) +{ +    double value; +    [sscanf][44](token, "%lf", &value); + +    if (column == column_x) { +        x = value; +    } else if (column == column_y) { +        y = value; +    } + +    column += 1; +    token = [strtok][43](NULL, delimiter); +} +``` + +Finally, when the **x** and **y** values are selected, insert the new data point in the linked list: + + +``` +struct data_point *datum = [malloc][45](sizeof(struct data_point)); +datum->x = x; +datum->y = y; + +SLIST_INSERT_HEAD(&head, datum, entries); +``` + +The [**malloc()**][46] function dynamically allocates (reserves) some persistent memory for the new data point. + +#### Fitting data + +The GSL linear fitting function [**gsl_fit_linear()**][47] expects simple arrays for its input. Therefore, since you won't know in advance the size of the arrays you create, you must manually allocate their memory: + + +``` +const size_t entries_number = row - skip_header - 1; + +double *x = [malloc][45](sizeof(double) * entries_number); +double *y = [malloc][45](sizeof(double) * entries_number); +``` + +Then, loop over the linked list to save the relevant data to the arrays: + + +``` +SLIST_FOREACH(datum, &head, entries) { +    const double current_x = datum->x; +    const double current_y = datum->y; + +    x[i] = current_x; +    y[i] = current_y; + +    i += 1; +} +``` + +Now that you are done with the linked list, clean it up. _Always_ release the memory that has been manually allocated to prevent a [memory leak][48]. Memory leaks are bad, bad, bad. Every time memory is not released, a garden gnome loses its head: + + +``` +while (!SLIST_EMPTY(&head)) { +    struct data_point *datum = SLIST_FIRST(&head); + +    SLIST_REMOVE_HEAD(&head, entries); + +    [free][49](datum); +} +``` + +Finally, finally(!), you can fit your data: + + +``` +gsl_fit_linear(x, 1, y, 1, entries_number, +               &intercept, &slope, +               &cov00, &cov01, &cov11, &chi_squared); +const double r_value = gsl_stats_correlation(x, 1, y, 1, entries_number); + +[printf][50]("Slope: %f\n", slope); +[printf][50]("Intercept: %f\n", intercept); +[printf][50]("Correlation coefficient: %f\n", r_value); +``` + +#### Plotting + +You must use an external program for the plotting. Therefore, save the fitting function to an external file: + + +``` +const double step_x = ((max_x + 1) - (min_x - 1)) / N; + +for (unsigned int i = 0; i < N; i += 1) { +    const double current_x = (min_x - 1) + step_x * i; +    const double current_y = intercept + slope * current_x; + +    [fprintf][51](output_file, "%f\t%f\n", current_x, current_y); +} +``` + +The Gnuplot command for plotting both files is: + + +``` +`plot 'fit_C99.csv' using 1:2 with lines title 'Fit', 'anscombe.csv' using 1:2 with points pointtype 7 title 'Data'` +``` + +#### Results + +Before running the program, you must compile it: + + +``` +`clang -std=c99 -I/usr/include/ fitting_C99.c -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_C99` +``` + +This command tells the compiler to use the C99 standard, read the **fitting_C99.c** file, load the libraries **gsl** and **gslcblas**, and save the result to **fitting_C99**. The resulting output on the command line is: + + +``` +#### Anscombe's first set with C99 #### +Slope: 0.500091 +Intercept: 3.000091 +Correlation coefficient: 0.816421 +``` + +Here is the resulting image generated with Gnuplot. + +![Plot and fit of the dataset obtained with C99][52] + +### The C++11 way + +[C++][53] is a general-purpose programming language that is also among the most popular languages in use today. It was created as a [successor of C][54] (in 1983) with an emphasis on [object-oriented programming][55] (OOP). C++ is commonly regarded as a superset of C, so a C program should be able to be compiled with a C++ compiler. This is not exactly true, as there are some corner cases where they behave differently. In my experience, C++ needs less boilerplate than C, but the syntax is more difficult if you want to develop objects. The C++11 standard is a recent revision that adds some nifty features and is more or less supported by compilers. + +Since C++ is largely compatible with C, I will just highlight the differences between the two. If I do not cover a section in this part, it means that it is the same as in C. + +#### Installation + +The dependencies for the C++ example are the same as the C example. On Fedora, run: + + +``` +`sudo dnf install clang gnuplot gsl gsl-devel` +``` + +#### Necessary libraries + +Libraries work in the same way as in C, but the **include** directives are slightly different: + + +``` +#include <cstdlib> +#include <cstring> +#include <iostream> +#include <fstream> +#include <string> +#include <vector> +#include <algorithm> + +extern "C" { +#include <gsl/gsl_fit.h> +#include <gsl/gsl_statistics_double.h> +} +``` + +Since the GSL libraries are written in C, you must inform the compiler about this peculiarity. + +#### Defining variables + +C++ supports more data types (classes) than C, such as a **string** type that has many more features than its C counterpart. Update the definition of the variables accordingly: + + +``` +`const std::string input_file_name("anscombe.csv");` +``` + +For structured objects like strings, you can define the variable without using the **=** sign. + +#### Printing output + +You can use the **printf()** function, but the **cout** object is more idiomatic. Use the operator **<<** to indicate the string (or objects) that you want to print with **cout**: + + +``` +std::cout << "#### Anscombe's first set with C++11 ####" << std::endl; + +... + +std::cout << "Slope: " << slope << std::endl; +std::cout << "Intercept: " << intercept << std::endl; +std::cout << "Correlation coefficient: " << r_value << std::endl; +``` + +#### Reading data + +The scheme is the same as before. The file is opened and read line-by-line, but with a different syntax: + + +``` +std::ifstream input_file(input_file_name); + +while (input_file.good()) { +    std::string line; + +    getline(input_file, line); + +    ... +} +``` + +The line tokens are extracted with the same function as in the C99 example. Instead of using standard C arrays, use two [vectors][56]. Vectors are an extension of C arrays in the [C++ standard library][57] that allows dynamic management of memory without explicitly calling **malloc()**: + + +``` +std::vector<double> x; +std::vector<double> y; + +// Adding an element to x and y: +x.emplace_back(value); +y.emplace_back(value); +``` + +#### Fitting data + +For fitting in C++, you do not have to loop over the list, as vectors are guaranteed to have contiguous memory. You can directly pass to the fitting function the pointers to the vectors buffers: + + +``` +gsl_fit_linear(x.data(), 1, y.data(), 1, entries_number, +               &intercept, &slope, +               &cov00, &cov01, &cov11, &chi_squared); +const double r_value = gsl_stats_correlation(x.data(), 1, y.data(), 1, entries_number); + +std::cout << "Slope: " << slope << std::endl; +std::cout << "Intercept: " << intercept << std::endl; +std::cout << "Correlation coefficient: " << r_value << std::endl; +``` + +#### Plotting + +Plotting is done with the same approach as before. Write to a file: + + +``` +const double step_x = ((max_x + 1) - (min_x - 1)) / N; + +for (unsigned int i = 0; i < N; i += 1) { +    const double current_x = (min_x - 1) + step_x * i; +    const double current_y = intercept + slope * current_x; + +    output_file << current_x << "\t" << current_y << std::endl; +} + +output_file.close(); +``` + +And then use Gnuplot for the plotting. + +#### Results + +Before running the program, it must be compiled with a similar command: + + +``` +`clang++ -std=c++11 -I/usr/include/ fitting_Cpp11.cpp -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_Cpp11` +``` + +The resulting output on the command line is: + + +``` +#### Anscombe's first set with C++11 #### +Slope: 0.500091 +Intercept: 3.00009 +Correlation coefficient: 0.816421 +``` + +And this is the resulting image generated with Gnuplot. + +![Plot and fit of the dataset obtained with C++11][58] + +### Conclusion + +This article provides examples for a data fitting and plotting task in C99 and C++11. Since C++ is largely compatible with C, this article exploited their similarities for writing the second example. In some aspects, C++ is easier to use because it partially relieves the burden of explicitly managing memory. But the syntax is more complex because it introduces the possibility of writing classes for OOP. However, it is still possible to write software in C with the OOP approach. Since OOP is a style of programming, it can be used in any language. There are some great examples of OOP in C, such as the [GObject][59] and [Jansson][60] libraries. + +For number crunching, I prefer working in C99 due to its simpler syntax and widespread support. Until recently, C++11 was not as widely supported, and I tended to avoid the rough edges in the previous versions. For more complex software, C++ could be a good choice. + +Do you use C or C++ for data science as well? Share your experiences in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/c-data-science + +作者:[Cristiano L. Fontana][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/cristianofontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://opensource.com/article/18/9/top-3-python-libraries-data-science +[3]: https://opensource.com/article/19/5/learn-python-r-data-science +[4]: https://en.wikipedia.org/wiki/C99 +[5]: https://en.wikipedia.org/wiki/C%2B%2B11 +[6]: https://en.wikipedia.org/wiki/Anscombe%27s_quartet +[7]: https://opensource.com/article/20/2/python-gnu-octave-data-science +[8]: https://en.wikipedia.org/wiki/Command-line_interface +[9]: https://en.wikipedia.org/wiki/Graphical_user_interface +[10]: https://gitlab.com/cristiano.fontana/polyglot_fit +[11]: https://en.wikipedia.org/wiki/Comma-separated_values +[12]: https://en.wikipedia.org/wiki/C_%28programming_language%29 +[13]: https://www.tiobe.com/tiobe-index/ +[14]: https://redmonk.com/sogrady/2019/07/18/language-rankings-6-19/ +[15]: http://pypl.github.io/PYPL.html +[16]: https://octoverse.github.com/ +[17]: https://en.wikipedia.org/wiki/Compiled_language +[18]: https://en.wikipedia.org/wiki/Compiler +[19]: https://en.wikipedia.org/wiki/Machine_code +[20]: https://en.wikipedia.org/wiki/C_standard_library +[21]: https://en.wiktionary.org/wiki/number-crunching +[22]: https://en.wikipedia.org/wiki/Boilerplate_code +[23]: https://clang.llvm.org/ +[24]: https://gcc.gnu.org/ +[25]: https://www.gnu.org/software/gsl/ +[26]: http://www.gnuplot.info/ +[27]: https://en.wikipedia.org/wiki/Berkeley_Software_Distribution +[28]: https://getfedora.org/ +[29]: https://en.wikipedia.org/wiki/Comment_(computer_programming) +[30]: https://en.wikipedia.org/wiki/Include_directive +[31]: https://en.wikipedia.org/wiki/Linker_%28computing%29 +[32]: https://en.wikipedia.org/wiki/Entry_point#C_and_C++ +[33]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_C99.c +[34]: https://en.wikipedia.org/wiki/Linked_list#Singly_linked_list +[35]: http://man7.org/linux/man-pages/man3/queue.3.html +[36]: https://en.wikipedia.org/wiki/Printf_format_string +[37]: http://www.opengroup.org/onlinepubs/009695399/functions/ferror.html +[38]: http://www.opengroup.org/onlinepubs/009695399/functions/feof.html +[39]: http://man7.org/linux/man-pages/man3/getline.3.html +[40]: https://en.wikipedia.org/wiki/POSIX +[41]: https://en.wikipedia.org/wiki/Lexical_analysis#Token +[42]: http://man7.org/linux/man-pages/man3/strtok.3.html +[43]: http://www.opengroup.org/onlinepubs/009695399/functions/strtok.html +[44]: http://www.opengroup.org/onlinepubs/009695399/functions/sscanf.html +[45]: http://www.opengroup.org/onlinepubs/009695399/functions/malloc.html +[46]: http://man7.org/linux/man-pages/man3/malloc.3.html +[47]: https://www.gnu.org/software/gsl/doc/html/lls.html +[48]: https://en.wikipedia.org/wiki/Memory_leak +[49]: http://www.opengroup.org/onlinepubs/009695399/functions/free.html +[50]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html +[51]: http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html +[52]: https://opensource.com/sites/default/files/uploads/fit_c99.png (Plot and fit of the dataset obtained with C99) +[53]: https://en.wikipedia.org/wiki/C%2B%2B +[54]: http://www.cplusplus.com/info/history/ +[55]: https://en.wikipedia.org/wiki/Object-oriented_programming +[56]: https://en.wikipedia.org/wiki/Sequence_container_%28C%2B%2B%29#Vector +[57]: https://en.wikipedia.org/wiki/C%2B%2B_Standard_Library +[58]: https://opensource.com/sites/default/files/uploads/fit_cpp11.png (Plot and fit of the dataset obtained with C++11) +[59]: https://en.wikipedia.org/wiki/GObject +[60]: http://www.digip.org/jansson/ From d177d35c672fb3c515c323cd7df5aee680ccc41e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 25 Feb 2020 01:05:03 +0800 Subject: [PATCH 068/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200224=20What?= =?UTF-8?q?=20developers=20need=20to=20know=20about=20domain-specific=20la?= =?UTF-8?q?nguages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200224 What developers need to know about domain-specific languages.md --- ...to know about domain-specific languages.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20200224 What developers need to know about domain-specific languages.md diff --git a/sources/tech/20200224 What developers need to know about domain-specific languages.md b/sources/tech/20200224 What developers need to know about domain-specific languages.md new file mode 100644 index 0000000000..8c274f42b8 --- /dev/null +++ b/sources/tech/20200224 What developers need to know about domain-specific languages.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What developers need to know about domain-specific languages) +[#]: via: (https://opensource.com/article/20/2/domain-specific-languages) +[#]: author: (Girish Managoli https://opensource.com/users/gammay) + +What developers need to know about domain-specific languages +====== +DSLs are used for a specific context in a particular domain. Learn more +about what they are and why you might want to use one. +![Various programming languages in use][1] + +A [domain-specific language][2] (DSL) is a language meant for use in the context of a particular domain. A domain could be a business context (e.g., banking, insurance, etc.) or an application context (e.g., a web application, database, etc.) In contrast, a general-purpose language (GPL) can be used for a wide range of business problems and applications. + +A DSL does not attempt to please all. Instead, it is created for a limited sphere of applicability and use, but it's powerful enough to represent and address the problems and solutions in that sphere. A good example of a DSL is HTML. It is a language for the web application domain. It can't be used for, say, number crunching, but it is clear how widely used HTML is on the web. + +A GPL creator does not know where the language might be used or the problems the user intends to solve with it. So, a GPL is created with generic constructs that potentially are usable for any problem, solution, business, or need. Java is a GPL, as it's used on desktops and mobile devices, embedded in the web across banking, finance, insurance, manufacturing, etc., and more. + +### Classifying DSLs + +In the DSL world, there are two types of languages: + + * **Domain-specific language (DSL):** The language in which a DSL is written or presented + * **Host language:** The language in which a DSL is executed or processed + + + +A DSL written in a distinct language and processed by another host language is called an **external** DSL. + +This is a DSL in SQL that can be processed in a host language: + + +``` +SELECT account +FROM accounts +WHERE account = '123' AND branch = 'abc' AND amount >= 1000 +``` + +For that matter, a DSL could be written in English with a defined vocabulary and form that can be processed in another host language using a parser generator like ANTLR: + + +``` +`if smokes then increase premium by 10%` +``` + +If the DSL and host language are the same, then the DSL type is **internal**, where the DSL is written in the language's semantics and processed by it. These are also referred to as **embedded** DSLs. Here are two examples. + + * A Bash DSL that can be executed in a Bash engine: [code]`if today_is_christmas; then apply_christmas_discount; fi` [/code] This is valid Bash that is written like English. + * A DSL written in a GPL like Java: [code] orderValue = orderValue +                .applyFestivalDiscount() +                .applyCustomerLoyalityDiscount() +                .applyCustomerAgeDiscount(); [/code] This uses a fluent style and is readable like English. + + + +Yes, the boundaries between DSL and GPL sometimes blur. + +### DSL examples + +Some languages used for DSLs include: + + * Web: HTML + * Shell: sh, Bash, CSH, and the likes for *nix; MS-DOS, Windows Terminal, PowerShell for Windows + * Markup languages: XML + * Modeling: UML + * Data management: SQL and its variants + * Business rules: Drools + * Hardware: Verilog, VHD + * Build tools: Maven, Gradle + * Numerical computation and simulation: MATLAB (commercial), GNU Octave, Scilab + * Various types of parsers and generators: Lex, YACC, GNU Bison, ANTLR + + + +### Why DSL? + +The purpose of a DSL is to capture or document the requirements and behavior of one domain. A DSL's usage might be even narrower for particular aspects within the domain (e.g., commodities trading in finance). DSLs bring business and technical teams together. This does not imply a DSL is for business use alone. For example, designers and developers can use a DSL to represent or design an application. + +A DSL can also be used to generate source code for an addressed domain or problem. However, code generation from a DSL is not considered mandatory, as its primary purpose is domain knowledge. However, when it is used, code generation is a serious advantage in domain engineering. + +### DSL pros and cons + +On the plus side, DSLs are powerful for capturing a domain's attributes. Also, since DSLs are small, they are easy to learn and use. Finally, a DSL offers a language for domain experts and between domain experts and developers. + +On the downside, a DSL is narrowly used within the intended domain and purpose. Also, a DSL has a learning curve, although it may not be very high. Additionally, although there may be advantages to using tools for DSL capture, they are not essential, and the development or configuration of such tools is an added effort. Finally, DSL creators need domain knowledge as well as language-development knowledge, and individuals rarely have both. + +### DSL software options + +Open source DSL software options include: + + * **Xtext:** Xtext enables the development of DSLs and is integrated with Eclipse. It makes code generation possible and has been used by several open source and commercial products to provide specific functions. [MADS][3] (Multipurpose Agricultural Data System) is an interesting idea based on Xtext for "modeling and analysis of agricultural activities" (however, the project seems to be no longer active). + * **JetBrains MPS:** JetBrains MPS is an integrated development environment (IDE) to create DSLs. It calls itself a projectional editor that stores a document as its underlying abstract tree structure. (This concept is also used by programs such as Microsoft Word.) JetBrains MPS also supports code generation to Java, C, JavaScript, or XML. + + + +### DSL best practices + +Want to use a DSL? Here are a few tips: + + * DSLs are not GPLs. Try to address limited ranges of problems in the definitive domain. + * You do not need to define your own DSL. That would be tedious. Look for an existing DSL that solves your need on sites like [DSLFIN][4], which lists DSLs for the finance domain. If you are unable to find a suitable DSL, you could define your own. + * It is better to make DSLs "like English" rather than too technical. + * Code generation from a DSL is not mandatory, but it offers significant and productive advantages when it is done. + * DSLs are called languages but, unlike GPLs, they need not be executable. Being executable is not the intent of a DSL. + * DSLs can be written with word processors. However, using a DSL editor makes syntax and semantics checks easier. + + + +If you are using DSL now or plan to do so in the future, please share your experience in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/domain-specific-languages + +作者:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_language_c.png?itok=mPwqDAD9 (Various programming languages in use) +[2]: https://en.wikipedia.org/wiki/Domain-specific_language +[3]: http://mads.sourceforge.net/ +[4]: http://www.dslfin.org/resources.html From a3b8b7e34d6f5035dadd35461921a199362f071d Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Tue, 25 Feb 2020 01:45:43 +0800 Subject: [PATCH 069/260] hankchow translating --- ...200214 Digging up IP addresses with the Linux dig command.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200214 Digging up IP addresses with the Linux dig command.md b/sources/tech/20200214 Digging up IP addresses with the Linux dig command.md index 1a941f9ff8..a0cc485bf6 100644 --- a/sources/tech/20200214 Digging up IP addresses with the Linux dig command.md +++ b/sources/tech/20200214 Digging up IP addresses with the Linux dig command.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f4ab09d35d2ecdf88d530a8238fca6e74ebf5bd8 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Tue, 25 Feb 2020 03:02:17 +0800 Subject: [PATCH 070/260] hankchow translated --- ...IP addresses with the Linux dig command.md | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) rename {sources => translated}/tech/20200214 Digging up IP addresses with the Linux dig command.md (63%) diff --git a/sources/tech/20200214 Digging up IP addresses with the Linux dig command.md b/translated/tech/20200214 Digging up IP addresses with the Linux dig command.md similarity index 63% rename from sources/tech/20200214 Digging up IP addresses with the Linux dig command.md rename to translated/tech/20200214 Digging up IP addresses with the Linux dig command.md index a0cc485bf6..0b95b0a753 100644 --- a/sources/tech/20200214 Digging up IP addresses with the Linux dig command.md +++ b/translated/tech/20200214 Digging up IP addresses with the Linux dig command.md @@ -7,27 +7,26 @@ [#]: via: (https://www.networkworld.com/article/3527430/digging-up-ip-addresses-with-the-dig-command.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -Digging up IP addresses with the Linux dig command +使用 dig 命令查询 IP 地址 ====== -The dig command is extremely versatile both for retrieving information from domain name servers and for troubleshooting. -Thinkstock +命令行工具 `dig` 是用于解析域名和故障排查的一个利器。 -Not unlike **nslookup** in function, but with a lot more options, the **dig** command provides information that name servers manage and can be very useful for troubleshooting problems. It’s both simple to use and has lots of useful options. +从主要功能上来说,`dig` 和 `nslookup` 之间差异不大,但 `dig` 更像一个加强版的 `nslookup`,可以查询到一些由域名服务器管理的信息,这在排查某些问题的时候非常有用。总的来说,`dig` 是一个既简单易用又功能强大的命令行工具。 -The name “dig” stands for “domain information groper” since domain groping is basically what it does. The amount of information that it provides depends on a series of options that you can use to tailor its output to your needs. Dig can provide a lot of detail or be surprisingly terse. +`dig` 最基本的功能就是查询域名信息,因此它的名称实际上是“域名信息查询工具Domain Information Groper”的缩写。`dig` 向用户返回的内容可以非常详尽,也可以非常简洁,展现内容的多少完全由用户在查询时使用的选项来决定。 [[Get regularly scheduled insights by signing up for Network World newsletters.]][1] -### Just the IP, please +### 我只需要查询 IP 地址 -To get _just_ the IP address for a system, add the **+short** option to your dig command like this: +如果只需要查询某个域名指向的 IP 地址,可以使用 `+short` 选项: ``` $ dig facebook.com +short 31.13.66.35 ``` -Don't be surprised, however, if some domains are tied to multiple IP addresses to make the sites they support more reliable. +在查询的时候发现有的域名会指向多个 IP 地址?这其实是网站提高其可用性的一种措施。 ``` $ dig networkworld.com +short @@ -37,7 +36,7 @@ $ dig networkworld.com +short 151.101.194.165 ``` -Also, don't be surprised if the order of the IP addresses changes from one query to the next. This is a side effect of load balancing. +也正是由于这些网站通过负载均衡实现高可用,在下一次查询的时候,或许会发现这几个 IP 地址的排序有所不同。 ``` $ dig networkworld.com +short @@ -47,9 +46,9 @@ $ dig networkworld.com +short 151.101.66.165 ``` -### Standard dig output +### 标准返回 -The standard dig display provides details on dig itself along with the response from the name server. +`dig` 的标准返回内容则包括这个工具本身的一些信息,以及请求域名服务器时返回的响应内容: ``` $ dig networkworld.com @@ -77,7 +76,7 @@ networkworld.com. 300 IN A 151.101.2.165 ;; MSG SIZE rcvd: 109 ``` -Since name servers generally cache collected data for a while, the query time shown at the bottom of dig output might sometimes might say "0 msec": +由于域名服务器有缓存机制,返回的内容可能是之前缓存好的信息。在这种情况下,`dig` 最后显示的查询时间Query time会是 0 毫秒(0 msec): [][2] @@ -88,11 +87,11 @@ Since name servers generally cache collected data for a while, the query time sh ;; MSG SIZE rcvd: 109 ``` -### Who you gonna ask? +### 向谁查询? -By default, dig will refer to your **/etc/resolv.conf** file to determine what name server to query, but you can refer queries to other DNS servers by adding an **@** option. +在默认情况下,`dig` 会根据 `/etc/resolv.conf` 这个文件的内容决定向哪个域名服务器获取查询结果。你也可以使用 `@` 来指定 `dig` 请求的域名服务器。 -In the example below, for example, the query is being sent to Google's name server (i.e., 8.8.8.8). +在下面的例子中,就指定了 `dig` 向 Google 的域名服务器 8.8.8.8 查询域名信息。 ``` $ dig @8.8.8.8 networkworld.com @@ -121,21 +120,21 @@ networkworld.com. 299 IN A 151.101.2.165 ;; MSG SIZE rcvd: 109 ``` -To determine what version of dig you’re using, use the **-v** option. You should see something like this: +想要知道正在使用的 `dig` 工具的版本,可以使用 `-v` 选项。你会看到类似这样: ``` $ dig -v DiG 9.11.5-P4-5.1ubuntu2.1-Ubuntu ``` -or this: +或者这样的返回信息: ``` $ dig -v DiG 9.11.4-P2-RedHat-9.11.4-22.P2.el8 ``` -To get just the answer portion of this response, you can omit name server details, but still get the answer you're looking for by using both a **+noall** (don't show everything) and a **+answer** (but show the answer section) like this: +如果你觉得 `dig` 返回的内容过于详细,可以使用 `+noall`(不显示所有内容)和 `+answer`(仅显示域名服务器的响应内容)选项,域名服务器的详细信息就会被忽略,只保留域名解析结果。 ``` $ dig networkworld.com +noall +answer @@ -148,9 +147,9 @@ networkworld.com. 300 IN A 151.101.66.165 networkworld.com. 300 IN A 151.101.2.165 ``` -### Looking up a batch of systems +### 批量查询域名 -If you want to dig for a series of domain names, you can list the domain names in a file and then use a command like this one to have dig run through the list and provide the information. +如果你要查询多个域名,可以把这些域名写入到一个文件内,然后使用下面的 `dig` 命令遍历整个文件并给出所有查询结果。 ``` $ dig +noall +answer -f domains @@ -165,7 +164,7 @@ amazon.com. 18 IN A 176.32.98.166 amazon.com. 18 IN A 205.251.242.103 ``` -You could add +short to the command above but, with some sites having multiple IP addresses, this might not be very useful. To cut down on the detail but be sure that you can tell which IP belongs to which domain, you could instead pass the output to **awk** to display just the first and last columns of data: +你也可以在上面的命令中使用 `+short` 选项,但如果其中有些域名指向多个 IP 地址,就无法看出哪些 IP 地址对应哪个域名了。在这种情况下,更好地做法应该是让 `awk` 对返回内容进行处理,只留下第一列和最后一列: ``` $ dig +noall +answer -f domains | awk '{print $1,$NF}' @@ -179,15 +178,13 @@ amazon.com. 205.251.242.103 amazon.com. 176.32.103.205 ``` -Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. - -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3527430/digging-up-ip-addresses-with-the-dig-command.html 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[HankChow](https://github.com/HankChow) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ac0babf872f0e55e86b3d721bde61a0b26d92790 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 25 Feb 2020 08:31:30 +0800 Subject: [PATCH 071/260] translated --- .../20200219 Don-t like IDEs- Try grepgitvi.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename {sources => translated}/tech/20200219 Don-t like IDEs- Try grepgitvi.md (69%) diff --git a/sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md b/translated/tech/20200219 Don-t like IDEs- Try grepgitvi.md similarity index 69% rename from sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md rename to translated/tech/20200219 Don-t like IDEs- Try grepgitvi.md index 0b3d10a279..a9b0118513 100644 --- a/sources/tech/20200219 Don-t like IDEs- Try grepgitvi.md +++ b/translated/tech/20200219 Don-t like IDEs- Try grepgitvi.md @@ -7,27 +7,27 @@ [#]: via: (https://opensource.com/article/20/2/no-ide-script) [#]: author: (Yedidyah Bar David https://opensource.com/users/didib) -Don't like IDEs? Try grepgitvi +不喜欢 IDE 么?试试看 grepgitvi ====== -A simple and primitive script to open Vim with your file of choice. +一个简单又原始的脚本来用 Vim 打开你选择的文件。 ![Files in a folder][1] -Like most developers, I search and read source code all day long. Personally, I've never gotten used to integrated development environments (IDEs), and for years, I mainly used **grep** and copy/pasted file names to open Vi(m). +像大多数开发者一样,我整天都在搜索和阅读源码。就我个人而言,我从来没有习惯集成开发环境 (IDE),多年来,我主要使用 **grep** 并复制/粘贴的文件名来打开 Vi(m)。 -Eventually, I came up with this script, slowly refining it as needed. +最终,我写了这个脚本,并根据需要缓慢地对其进行了完善。 -Its dependencies are [Vim][2] and [rlwrap][3], and it is open source under the Apache 2.0 license. To use the script, [put it in your PATH][4], and run it inside a directory of text files with: +它依赖 [Vim][2] 和 [rlwrap][3],并使用 Apache 2.0 许可开源。要使用该脚本,请[将它放到 PATH 中][4],然后在文本目录下运行: ``` `grepgitvi ` ``` -It will return a numbered list of search results, prompt you for the number of the result you want to use, and open Vim with that result. After you exit Vim, it will show the list again in a loop until you enter anything other than a result number. You can also use the Up and Down arrow keys to select a file; this makes it easier (for me) to find which results I've already looked at. +它将返回搜索结果的编号列表,并提示你输入结果编号并打开 Vim。退出 Vim 后,它将再次显示列表,直到你输入除结果编号以外的任何内容。你也可以使用向上和向下箭头键选择一个文件。(这对我来说)更容易找到我已经看过的结果。 -It's simple and primitive compared to modern IDEs, or even to more sophisticated uses of Vim, but that's what does the job for me. +与现代 IDE 甚至与 Vim 的更复杂的用法相比,它简单而原始,但它对我有用。 -### The script +### 脚本 ``` @@ -90,7 +90,7 @@ via: https://opensource.com/article/20/2/no-ide-script 作者:[Yedidyah Bar David][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/) 荣誉推出 From 320498ba05c98ecb0c3340627b051098ab080f29 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 25 Feb 2020 08:34:14 +0800 Subject: [PATCH 072/260] translating --- sources/tech/20200217 How to get MongoDB Server on Fedora.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200217 How to get MongoDB Server on Fedora.md b/sources/tech/20200217 How to get MongoDB Server on Fedora.md index 6f85674c67..4eaad84766 100644 --- a/sources/tech/20200217 How to get MongoDB Server on Fedora.md +++ b/sources/tech/20200217 How to get MongoDB Server on Fedora.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4990d0f07cef1e921ea5bcdaabd49be1338ebe1e Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 25 Feb 2020 08:57:31 +0800 Subject: [PATCH 073/260] translating --- ... to use byobu to multiplex SSH sessions.md | 2 +- ...217 How to get MongoDB Server on Fedora.md | 132 ------------------ 2 files changed, 1 insertion(+), 133 deletions(-) delete mode 100644 sources/tech/20200217 How to get MongoDB Server on Fedora.md diff --git a/sources/tech/20200212 How to use byobu to multiplex SSH sessions.md b/sources/tech/20200212 How to use byobu to multiplex SSH sessions.md index bd36764af1..7b79a351f8 100644 --- a/sources/tech/20200212 How to use byobu to multiplex SSH sessions.md +++ b/sources/tech/20200212 How to use byobu to multiplex SSH sessions.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20200217 How to get MongoDB Server on Fedora.md b/sources/tech/20200217 How to get MongoDB Server on Fedora.md deleted file mode 100644 index 4eaad84766..0000000000 --- a/sources/tech/20200217 How to get MongoDB Server on Fedora.md +++ /dev/null @@ -1,132 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to get MongoDB Server on Fedora) -[#]: via: (https://fedoramagazine.org/how-to-get-mongodb-server-on-fedora/) -[#]: author: (Honza Horak https://fedoramagazine.org/author/hhorak/) - -How to get MongoDB Server on Fedora -====== - -![][1] - -Mongo (from “humongous”) is a high-performance, open source, schema-free document-oriented database, which is one of the most favorite so-called [NoSQL][2] databases. It uses JSON as a document format, and it is designed to be scalable and replicable across multiple server nodes. - -### Story about license change - -It’s been more than a year when the upstream MongoDB decided to change the license of the Server code. The previous license was GNU Affero General Public License v3 (AGPLv3). However, upstream wrote a new license designed to make companies running MongoDB as a service contribute back to the community. The new license is called Server Side Public License (SSPLv1) and more about this step and its rationale can be found at [MongoDB SSPL FAQ][3]. - -Fedora has always included only free (as in “freedom”) software. When SSPL was released, Fedora [determined][4] that it is not a free software license in this meaning. All versions of MongoDB released before the license change date (October 2018) could be potentially kept in Fedora, but never updating the packages in the future would bring security issues. Hence the Fedora community decided to [remove the MongoDB server][5] entirely, starting Fedora 30. - -### What options are left to developers? - -Well, alternatives exist, for example PostgreSQL also supports JSON in the recent versions, and it can be used in cases when MongoDB cannot be used any more. With JSONB type, indexing works very well in PostgreSQL with performance comparable with MongoDB, and even without any compromises from ACID. - -The technical reasons that a developer may have chosen MongoDB did not change with the license, so many still want to use it. What is important to realize is that the SSPL license was only changed to the MongoDB server. There are other projects that MongoDB upstream develops, like MongoDB tools, C and C++ client libraries and connectors for various dynamic languages, that are used on the client side (in applications that want to communicate with the server over the network). Since the license is kept free (Apache License mostly) for those packages, they are staying in Fedora repositories, so users can use them for the application development. - -The only change is really the server package itself, which was removed entirely from Fedora repos. Let’s see what a Fedora user can do to get the non-free packages. - -### How to install MongoDB server from the upstream - -When Fedora users want to install a MongoDB server, they need to approach MongoDB upstream directly. However, the upstream does not ship RPM packages for Fedora itself. Instead, the MongoDB server is either available as the source tarball, that users need to compile themselves (which requires some developer knowledge), or Fedora user can use some compatible packages. From the compatible options, the best choice is the RHEL-8 RPMs at this point. The following steps describe, how to install them and how to start the daemon. - -#### 1\. Create a repository with upstream RPMs (RHEL-8 builds) -``` - -``` - -$ sudo cat > /etc/yum.repos.d/mongodb.repo &lt;&lt;EOF -[mongodb-upstream] -name=MongoDB Upstream Repository -baseurl= -gpgcheck=1 -enabled=1 -gpgkey= -EOF -``` - -``` - -#### 2\. Install the meta-package, that pulls the server and tools packages -``` - -``` - -$ sudo dnf install mongodb-org -&lt;snipped> -Installed: -  mongodb-org-4.2.3-1.el8.x86_64           mongodb-org-mongos-4.2.3-1.el8.x86_64   -  mongodb-org-server-4.2.3-1.el8.x86_64    mongodb-org-shell-4.2.3-1.el8.x86_64 -  mongodb-org-tools-4.2.3-1.el8.x86_64           - -Complete! -``` - -``` - -#### 3\. Start the MongoDB daemon -``` - -``` - -$ sudo systemctl status mongod -● mongod.service - MongoDB Database Server -   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) -   Active: active (running) since Sat 2020-02-08 12:33:45 EST; 2s ago -     Docs: -  Process: 15768 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS) -  Process: 15769 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS) -  Process: 15770 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS) -  Process: 15771 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS) - Main PID: 15773 (mongod) -   Memory: 70.4M -      CPU: 611ms -   CGroup: /system.slice/mongod.service -           └─15773 /usr/bin/mongod -f /etc/mongod.conf -``` - -``` - -#### 4\. Verify that the server runs by connecting to it from the mongo shell -``` - -``` - -$ mongo -MongoDB shell version v4.2.3 -connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&amp;gssapiServiceName=mongodb -Implicit session: session { "id" : UUID("20b6e61f-c7cc-4e9b-a25e-5e306d60482f") } -MongoDB server version: 4.2.3 -Welcome to the MongoDB shell. -For interactive help, type "help". -For more comprehensive documentation, see -    -\--- - -> _ -``` - -``` - -That’s all. As you see, the RHEL-8 packages are pretty compatible and it should stay that way for as long as the Fedora packages remain compatible with what’s in RHEL-8. Just be careful that you comply with the SSPLv1 license in your use. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/how-to-get-mongodb-server-on-fedora/ - -作者:[Honza Horak][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/hhorak/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/mongodb-816x348.png -[2]: https://en.wikipedia.org/wiki/NoSQL -[3]: https://www.mongodb.com/licensing/server-side-public-license/faq -[4]: https://lists.fedoraproject.org/archives/list/legal@lists.fedoraproject.org/thread/IQIOBOGWJ247JGKX2WD6N27TZNZZNM6C/ -[5]: https://fedoraproject.org/wiki/Changes/MongoDB_Removal From d8afa83e61bc0105e834e61cd42b3912de33b066 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 25 Feb 2020 10:32:51 +0800 Subject: [PATCH 074/260] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zhangxiangping 翻译的不错 --- ...e tools for natural language processing.md | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/translated/tech/20190322 12 open source tools for natural language processing.md b/translated/tech/20190322 12 open source tools for natural language processing.md index b6ef9f8091..3ae521d493 100644 --- a/translated/tech/20190322 12 open source tools for natural language processing.md +++ b/translated/tech/20190322 12 open source tools for natural language processing.md @@ -1,93 +1,95 @@ [#]: collector: (lujun9972) [#]: translator: (zhangxiangping) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (12 open source tools for natural language processing) [#]: via: (https://opensource.com/article/19/3/natural-language-processing-tools) -[#]: author: (Dan Barker https://opensource.com/users/barkerd427) +[#]: author: (Dan Barker https://opensource.com/users/barkerd427) -12种自然语言处理的开源工具 +12 种自然语言处理的开源工具 ====== -看看可以用在你自己NLP应用中的十几个工具吧。 +> 让我们看看可以用在你自己的 NLP 应用中的十几个工具吧。 -![Chat bubbles][1] +![](https://img.linux.net.cn/data/attachment/album/202002/25/103230j77i7zx8uyymj7y3.jpg) -在过去的几年里,自然语言处理(NLP)推动了聊天机器人、语音助手、文本预测,这些在我们的日常生活中常用的语音或文本应用程技术的发展。目前有着各种各样开源的NLP工具,所以我决定调查一下当前开源的NLP工具来帮助您制定您开发下一个基于语音或文本的应用程序的计划。 +在过去的几年里,自然语言处理(NLP)推动了聊天机器人、语音助手、文本预测等这些渗透到我们的日常生活中的语音或文本应用程技术的发展。目前有着各种各样开源的 NLP 工具,所以我决定调查一下当前开源的 NLP 工具来帮助你制定开发下一个基于语音或文本的应用程序的计划。 -我将从我所熟悉的编程语言出发来介绍这些工具,尽管我对这些工具不是很熟悉(我没有在我不熟悉的语言中找工具)。也就是说,出于各种原因,我排除了三种我熟悉的语言中的工具。 +尽管我并不熟悉所有工具,但我将从我所熟悉的编程语言出发来介绍这些工具(对于我不熟悉的语言,我无法找到大量的工具)。也就是说,出于各种原因,我排除了三种我熟悉的语言之外的工具。 -R语言是没有被包含在内的,因为我发现的大多数库都有一年多没有更新了。这并不总是意味着他们没有得到很好的维护,但我认为他们应该得到更多的更新,以便和同一领域的其他工具竞争。我还选择了最有可能在生产场景中使用的语言和工具(而不是在学术界和研究中使用),虽然我主要是使用R作为研究和发现工具。 +R 语言可能是没有被包含在内的最重要的语言,因为我发现的大多数库都有一年多没有更新了。这并不一定意味着它们没有得到很好的维护,但我认为它们应该得到更多的更新,以便和同一领域的其他工具竞争。我还选择了最有可能用在生产场景中的语言和工具(而不是在学术界和研究中使用),而我主要是使用 R 作为研究和发现工具。 -我发现Scala的很多库都没有更新了。我上次使用Scala已经有好几年了,当时它非常流行。但是大多数库从那个时候就再没有更新过,或者只有少数一些有更新。 +我也惊讶地发现 Scala 的很多库都没有更新了。我上次使用 Scala 已经过去了两年了,当时它非常流行。但是大多数库从那个时候就再没有更新过,或者只有少数一些有更新。 -最后,我排除了C++。这主要是因为我在的公司很久没有使用C++来进行NLP或者任何数据科学的工作。 +最后,我排除了 C++。 这主要是因为我上次使用 C++ 编写程序已经有很多年了,而我所工作的组织还没有将 C++ 用于 NLP 或任何数据科学方面的工作。 -### Python工具 -#### Natural Language Toolkit (NLTK) +### Python 工具 -[Natural Language Toolkit (NLTK)][2]是我调研的所有工具中功能最完善的一个。它完美地实现了自然语言处理中多数功能组件,比如分类,令牌化,词干化,标注,分词和语义推理。每一种方法都有多种不同的实现方式,所以你可以选择具体的算法和方式去使用它。同时,它也支持不同语言。然而,它将所有的数据都表示为字符串的形式,对于一些简单的数据结构来说可能很方便,但是如果要使用一些高级的功能来说就可能有点困难。它的使用文档有点复杂,但也有很多其他人编写的使用文档,比如[a great book][3]。和其他的工具比起来,这个工具库的运行速度有点慢。但总的来说,这个工具包非常不错,可以用于需要具体算法组合的实验,探索和实际应用当中。 +#### 自然语言工具包(NLTK) + +毋庸置疑,[自然语言工具包(NLTK)][2]是我调研过的所有工具中功能最完善的一个。它几乎实现了自然语言处理中多数功能组件,比如分类、令牌化、词干化、标注、分词和语义推理。每一个都有多种不同的实现方式,所以你可以选择具体的算法和方式。同时,它也支持不同的语言。然而,它以字符串的形式表示所有的数据,对于一些简单的数据结构来说可能很方便,但是如果要使用一些高级的功能来说就可能有点困难。它的使用文档有点复杂,但也有很多其他人编写的使用文档,比如[这本很棒的书][3]。和其他的工具比起来,这个工具库的运行速度有点慢。但总的来说,这个工具包非常不错,可以用于需要具体算法组合的实验、探索和实际应用当中。 #### SpaCy -[SpaCy][4]是NLTK的主要竞争者。在大多数情况下都比NLTK的速度更快,但是SpaCy对自然语言处理的功能组件只有单一实现。SpaCy把所有的东西都表示为一个对象而不是字符串,这样就能够为构建应用简化接口。这也方便它能够集成多种框架和数据科学的工具,使得你更容易理解你的文本数据。然而,SpaCy不像NLTK那样支持多种语言。它对每个接口都有一些简单的选项和文档,包括用于语言处理和分析各种组件的多种神经网络模型。总的来说,如果创造一个新的应用的生产过程中不需要使用特定的算法的话,这是一个很不错的工具。 +[SpaCy][4] 可能是 NLTK 的主要竞争者。在大多数情况下都比 NLTK 的速度更快,但是 SpaCy 的每个自然语言处理的功能组件只有一个实现。SpaCy 把所有的东西都表示为一个对象而不是字符串,从而简化了应用构建接口。这也方便它与多种框架和数据科学工具的集成,使得你更容易理解你的文本数据。然而,SpaCy 不像 NLTK 那样支持多种语言。它确实接口简单,具有简化的选项集和完备的文档,以及用于语言处理和分析各种组件的多种神经网络模型。总的来说,对于需要在生产中表现出色且不需要特定算法的新应用程序,这是一个很不错的工具。 #### TextBlob -[TextBlob][5]是NLTK的一个扩展库。你可以通过TextBlob用一种更简单的方式来使用NLTK的功能,TextBlob也包括了Pattern库中的功能。如果你刚刚开始学习,这将会是一个不错的工具可以用于生产对性能要求不太高的应用。TextBlob适用于任何场景,但是对小型项目会更加合适。 +[TextBlob][5] 是 NLTK 的一个扩展库。你可以通过 TextBlob 用一种更简单的方式来使用 NLTK 的功能,TextBlob 也包括了 Pattern 库中的功能。如果你刚刚开始学习,这将会是一个不错的工具,可以用于对性能要求不太高的生产环境的应用。总体来说,TextBlob 适用于任何场景,但是对小型项目尤佳。 #### Textacy -这个工具是我用过的名字最好听的。读"[Textacy][6]" 时先发出"ex"再发出"cy"。它不仅仅是名字好,同时它本身也是一个很不错的工具。它使用SpaCy作为它自然语言处理核心功能,但它在处理过程的前后做了很多工作。如果你想要使用SpaCy,你可以先使用Textacy,从而不用去多写额外的附加代码你就可以处理不同种类的数据。 +这个工具是我用过的名字最好听的。先重读“ex”再带出“cy”,多读“[Textacy][6]”几次试试。它不仅仅是名字读起来好,同时它本身也是一个很不错的工具。它使用 SpaCy 作为它自然语言处理核心功能,但它在处理过程的前后做了很多工作。如果你想要使用 SpaCy,那么最好使用 Textacy,从而不用去编写额外的附加代码就可以处理不同种类的数据。 #### PyTorch-NLP -[PyTorch-NLP][7]才出现短短的一年,但它已经有一个庞大的社区了。它适用于快速原型开发。当公司或者研究人员推出很多其他工具去完成新奇的处理任务,比如图像转换,它就会被更新。PyTorch的目标用户是研究人员,但它也能用于原型开发,或在最开始的生产任务中使用最好的算法。基于此基础上的创建的库也是值得研究的。 +[PyTorch-NLP][7] 才出现短短的一年,但它已经有一个庞大的社区了。它适用于快速原型开发。当出现了最新的研究,或大公司或者研究人员推出了完成新奇的处理任务的其他工具时,比如图像转换,它就会被更新。总体来说,PyTorch 的目标用户是研究人员,但它也能用于原型开发,或使用最先进算法的初始生产载荷中。基于此基础上的创建的库也是值得研究的。 -### 节点工具 +### Node.js 工具 #### Retext -[Retext][8]是[unified collective][9]的一部分。Unified是一个接口,能够集成不同的工具和插件以便他们能够高效的工作。Retext是unified工具集三个中的一个,另外的两个分别是用于markdown编辑的Remark和用于HTML处理的Rehype。这是一个非常有趣的想法,我很高兴看到这个社区的发展。Retext没有暴露过多的底层技术,更多的是使用插件去完成你在NLP任务中想要做的事情。拼写检查,固定排版,情绪检测和可读性分析都可以用简单的插件来完成。如果你不想了解底层处理技术又想完成你的任务的话,这个工具和社区是一个不错的选择。 +[Retext][8] 是 [Unified 集合][9]的一部分。Unified 是一个接口,能够集成不同的工具和插件以便它们能够高效的工作。Retext 是 Unified 工具中使用的三种语法之一,另外的两个分别是用于 Markdown 的 Remark 和用于 HTML 的 Rehype。这是一个非常有趣的想法,我很高兴看到这个社区的发展。Retext 没有涉及很多的底层技术,更多的是使用插件去完成你在 NLP 任务中想要做的事情。拼写检查、字形修复、情绪检测和增强可读性都可以用简单的插件来完成。总体来说,如果你不想了解底层处理技术又想完成你的任务的话,这个工具和社区是一个不错的选择。 #### Compromise -如果你在找拥有最高级的功能和最复杂的系统的工具的话,[Compromise][10]不是你的选择。 然而,如果你想要一个性能好,应用广泛,还能在客户端运行的工具的话,Compromise值得一试。实际上,它的名字是准确的,因为作者更关注更具体功能的小软件包,而在功能性和准确性上做出了牺牲,这些功能得益于用户对使用环境的理解。 +[Compromise][10] 显然不是最复杂的工具,如果你正在找拥有最先进的算法和最完备的系统的话,它可能不适合你。然而,如果你想要一个性能好、功能广泛、还能在客户端运行的工具的话,Compromise 值得一试。总体来说,它的名字(“折中”)是准确的,因为作者更关注更具体功能的小软件包,而在功能性和准确性上有所折中,这些小软件包得益于用户对使用环境的理解。 #### Natural -[Natural][11]包含了一般自然语言处理库所具有的大多数功能。它主要是处理英文文本,但也包括一些其他语言,它的社区也支持额外的语言。它能够进行令牌化,词干化,分类,语音处理,词频-逆文档频率计算(TF-IDF),WordNet,字符相似度计算和一些变换。它和NLTK有的一比,因为它想要把所有东西都包含在一个包里头,使用方便但是可能不太适合专注的研究。总的来说,这是一个不错的功能齐全的库,目前仍在开发但可能需要对底层实现有更多的了解才能完更有效。 +[Natural][11] 包含了常规自然语言处理库所具有的大多数功能。它主要是处理英文文本,但也包括一些其它语言,它的社区也欢迎支持其它的语言。它能够进行令牌化、词干化、分类、语音处理、词频-逆文档频率计算(TF-IDF)、WordNet、字符相似度计算和一些变换。它和 NLTK 有的一比,因为它想要把所有东西都包含在一个包里头,但它更易于使用,而且不一定专注于研究。总的来说,这是一个非常完整的库,目前仍在活跃开发中,但可能需要对底层实现有更多的了解才能完全发挥效力。 #### Nlp.js -[Nlp.js][12]是在其他几个NLP库上开发的,包括Franc和Brain.js。它提供了一个能很好支持NLP组件的接口,比如分类,情感分析,词干化,命名实体识别和自然语言生成。它也支持一些其他语言,在你处理除了英语之外的语言时也能提供一些帮助。总之,它是一个不错的通用工具,能够提供简单的接口去调用其他工具。在你需要更强大或更灵活的工具之前,这个工具可能会在你的应用程序中用上很长一段时间。 +[Nlp.js][12] 建立在其他几个 NLP 库之上,包括 Franc 和 Brain.js。它为许多 NLP 组件提供了一个很好的接口,比如分类、情感分析、词干化、命名实体识别和自然语言生成。它也支持一些其它语言,在你处理英语之外的语言时能提供一些帮助。总之,它是一个不错的通用工具,并且提供了调用其他工具的简化接口。在你需要更强大或更灵活的工具之前,这个工具可能会在你的应用程序中用上很长一段时间。 + +### Java 工具 -### Java工具 #### OpenNLP -[OpenNLP][13]是由Apache基金会维护的,所以它可以很方便地集成到其他Apache项目中,比如Apache Flink,Apache NiFi和Apache Spark。这是一个通用的NLP工具,包含了所有NLP组件中的通用功能,可以通过命令行或者以包的形式导入到应用中来使用它。它也支持很多种语言。OpenNLP是一个很高效的工具,包含了很多特性,如果你用Java开发生产的话,它是个很好的选择。 +[OpenNLP][13] 是由 Apache 基金会管理的,所以它可以很方便地集成到其他 Apache 项目中,比如 Apache Flink、Apache NiFi 和 Apache Spark。这是一个通用的 NLP 工具,包含了所有 NLP 组件中的通用功能,可以通过命令行或者以包的形式导入到应用中来使用它。它也支持很多种语言。OpenNLP 是一个很高效的工具,包含了很多特性,如果你用 Java 开发生产环境产品的话,它是个很好的选择。 -#### StanfordNLP +#### Stanford CoreNLP -[Stanford CoreNLP][14]是一个工具集,提供了基于统计的,基于深度学习和基于规则的NLP功能。这个工具也有许多其他编程语言的版本,所以可以脱离Java来使用。它是由高水平的研究机构创建的一个高效的工具,但在生产环境中可能不是最好的。此工具具有双重许可,并具有可以用于商业目的的特殊许可。总之,在研究和实验中它是一个很棒的工具,但在生产系统中可能会带来一些额外的开销。比起Java版本来说,读者可能对它的Python版本更感兴趣。斯坦福教授在Coursera上教的最好的机器学习课程之一,[点此][15]访问其他不错的资源。 +[Stanford CoreNLP][14] 是一个工具集,提供了统计 NLP、深度学习 NLP 和基于规则的 NLP 功能。这个工具也有许多其他编程语言的版本,所以可以脱离 Java 来使用。它是由高水平的研究机构创建的一个高效的工具,但在生产环境中可能不是最好的。此工具采用双许可证,具有可以用于商业目的的特定许可证。总之,在研究和实验中它是一个很棒的工具,但在生产系统中可能会带来一些额外的成本。比起 Java 版本来说,读者可能对它的 Python 版本更感兴趣。同样,在 Coursera 上最好的机器学习课程之一是斯坦福教授提供的,[点此][15]访问其他不错的资源。 #### CogCompNLP -[CogCompNLP][16]由伊利诺斯大学开发的一个工具,它也有一个相似功能的Python版本事项。它可以用于处理文本,包括本地处理和远程处理,能够极大地缓解你本地设备的压力。它提供了很多处理函数,比如令牌化,词性分析,标注,断句,命名实体标注,词型还原,依存分析和语义角色标注。它是一个很好的研究工具,你可以自己探索它的不同功能。我不确定它是否适合生产环境,但如果你使用Java的话,它值得一试。 +[CogCompNLP][16] 由伊利诺斯大学开发的一个工具,它也有一个相似功能的 Python 版本。它可以用于处理文本,包括本地处理和远程处理,能够极大地缓解你本地设备的压力。它提供了很多处理功能,比如令牌化、词性标注、断句、命名实体标注、词型还原、依存分析和语义角色标注。它是一个很好的研究工具,你可以自己探索它的不同功能。我不确定它是否适合生产环境,但如果你使用 Java 的话,它值得一试。 * * * -你最喜欢的开源的NLP工具和库是什么?请在评论区分享文中没有提到的工具。 +你最喜欢的开源 NLP 工具和库是什么?请在评论区分享文中没有提到的工具。 -------------------------------------------------------------------------------- via: https://opensource.com/article/19/3/natural-language-processing-tools -作者:[Dan Barker (Community Moderator)][a] +作者:[Dan Barker][a] 选题:[lujun9972][b] 译者:[zxp](https://github.com/zhangxiangping) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 855d11a28eaa147610e4162bd0df01f2c8614274 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 25 Feb 2020 10:35:22 +0800 Subject: [PATCH 075/260] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zhangxiangping 恭喜你完成了第一篇翻译贡献,翻译的不错。抱歉整整两周才发布出来。 本文首发地址: https://linux.cn/article-11927-1.html 你的 LCTT 专页地址: https://linux.cn/lctt/zhangxiangping 请注册以领取 LCCN: https://lctt.linux.cn/ --- ...22 12 open source tools for natural language processing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190322 12 open source tools for natural language processing.md (99%) diff --git a/translated/tech/20190322 12 open source tools for natural language processing.md b/published/20190322 12 open source tools for natural language processing.md similarity index 99% rename from translated/tech/20190322 12 open source tools for natural language processing.md rename to published/20190322 12 open source tools for natural language processing.md index 3ae521d493..ee4bf2e0ec 100644 --- a/translated/tech/20190322 12 open source tools for natural language processing.md +++ b/published/20190322 12 open source tools for natural language processing.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhangxiangping) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11927-1.html) [#]: subject: (12 open source tools for natural language processing) [#]: via: (https://opensource.com/article/19/3/natural-language-processing-tools) [#]: author: (Dan Barker https://opensource.com/users/barkerd427) From c1d131120ff5e57d073e8b67962313245152bd77 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 25 Feb 2020 11:48:47 +0800 Subject: [PATCH 076/260] PRF @geekpi --- ...to Install Latest Git Version on Ubuntu.md | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md b/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md index b6b240dadc..6e0654d7a3 100644 --- a/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md +++ b/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install Latest Git Version on Ubuntu) @@ -25,7 +25,7 @@ sudo apt install git 这就是为什么当你检查 Git 版本时,会看到安装的版本会比 [Git 网站上当前最新 Git 版本][4]旧: ``` -[email protected]:~$ git --version +$ git --version git version 2.17.1 ``` @@ -43,35 +43,35 @@ sudo apt update sudo apt install git ``` -即使你以前使用 apt 安装了 Git,它也将更新为最新的稳定版本。 +即使你以前使用 `apt` 安装了 Git,它也将更新为最新的稳定版本。 ``` -[email protected]:~$ git --version +$ git --version git version 2.25.0 ``` -[使用PPA][8] 的好处在于,如果发布了新的 Git 稳定版本,那么就可以通过系统更新获得它。[仅更新 Ubuntu][9]来获取最新的 Git 稳定版本。 +[使用PPA][8] 的好处在于,如果发布了新的 Git 稳定版本,那么就可以通过系统更新获得它。[仅更新 Ubuntu][9] 来获取最新的 Git 稳定版本。 -### 配置Git (推荐给开发者) +### 配置 Git (推荐给开发者) 如果你出于开发目的安装了 Git,你会很快开始克隆仓库,进行更改并提交更改。 如果你尝试提交代码,那么你可能会看到 “Please tell me who you are” 这样的错误: ``` -[email protected]:~/compress-pdf$ git commit -m "update readme" +$ git commit -m "update readme" *** Please tell me who you are. Run - git config --global user.email "[email protected]" + git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. -fatal: unable to auto-detect email address (got '[email protected](none)') +fatal: unable to auto-detect email address (got 'abhishek@itsfoss.(none)') ``` 这是因为你还没配置必要的个人信息。 @@ -80,7 +80,7 @@ fatal: unable to auto-detect email address (got '[email protected](none)') ``` git config --global user.name "Your Name" -git config --global user.email "[email protected]" +git config --global user.email "you@example.com" ``` 你可以使用以下命令检查 Git 配置: @@ -92,15 +92,13 @@ git config --list 它应该显示如下输出: ``` -[email protected] -user.name=abhishek +user.email=you@example.com +user.name=Your Name ``` -配置保存在 \~/.gitconfig 中。你可以手动修改配置。 +配置保存在 `~/.gitconfig` 中。你可以手动修改配置。 -* * * - -**结尾** +### 结尾 我希望这个小教程可以帮助你在 Ubuntu 上安装 Git。使用 PPA,你可以轻松获得最新的 Git 版本。 @@ -113,7 +111,7 @@ via: https://itsfoss.com/install-git-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -127,4 +125,4 @@ via: https://itsfoss.com/install-git-ubuntu/ [6]: https://itsfoss.com/install-software-from-source-code/ [7]: https://launchpad.net/~git-core/+archive/ubuntu/ppa [8]: https://itsfoss.com/ppa-guide/ -[9]: https://itsfoss.com/update-ubuntu/ \ No newline at end of file +[9]: https://itsfoss.com/update-ubuntu/ From 6ec54b5d70e2758ab80ffefb7b9e171d1a39b7a7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 25 Feb 2020 11:49:21 +0800 Subject: [PATCH 077/260] PUB @geekpi https://linux.cn/article-11929-1.html --- .../20200219 How to Install Latest Git Version on Ubuntu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200219 How to Install Latest Git Version on Ubuntu.md (98%) diff --git a/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md b/published/20200219 How to Install Latest Git Version on Ubuntu.md similarity index 98% rename from translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md rename to published/20200219 How to Install Latest Git Version on Ubuntu.md index 6e0654d7a3..c05c0d3c02 100644 --- a/translated/tech/20200219 How to Install Latest Git Version on Ubuntu.md +++ b/published/20200219 How to Install Latest Git Version on Ubuntu.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11929-1.html) [#]: subject: (How to Install Latest Git Version on Ubuntu) [#]: via: (https://itsfoss.com/install-git-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 5bd3368f0d5bda0a79ce227fc9a8b0b6a2dc28e7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 25 Feb 2020 12:55:33 +0800 Subject: [PATCH 078/260] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @guevaraya 翻译后应该审读至少一遍。 --- ...etes with the power of tmux and kubectl.md | 161 +++++++++--------- 1 file changed, 79 insertions(+), 82 deletions(-) diff --git a/translated/tech/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md b/translated/tech/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md index b807e99fb1..1f5a4e3ff6 100644 --- a/translated/tech/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md +++ b/translated/tech/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md @@ -1,58 +1,58 @@ [#]: collector: (lujun9972) -[#]: translator: ( guevaraya) -[#]: reviewer: ( ) +[#]: translator: (guevaraya) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Troubleshoot Kubernetes with the power of tmux and kubectl) [#]: via: (https://opensource.com/article/20/2/kubernetes-tmux-kubectl) [#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) -解决 Kubernetes 问题的利器 Tmux 和 kubectl +利用 Tmux 和 kubectl 解决 Kubernetes 故障 ====== -一个 kubectl 插件 用 tmux 使 Kubernetes 疑难问题变得更简单。 -![一个坐在笔记本面前的妇女][1] +> 一个使用 tmux 的 kubectl 插件可以使 Kubernetes 疑难问题变得更简单。 -[Kubernetes][2] 是一个活跃的开源容器管理平台,它提供了可扩展性,高可用性,健壮性和富有弹性的应用程序管理。它的众多特性之一是支持通过原生的客户端程序 [kubectl][3] 运行定制脚本或可执行程序,Kubectl 很强大的,允许用户在 Kubernetes 集群上用它直接做很多事情。 +![](https://img.linux.net.cn/data/attachment/album/202002/25/125435a4v3vpss3s4w3sks.jpg) + +[Kubernetes][2] 是一个活跃的开源容器管理平台,它提供了可扩展性、高可用性、健壮性和富有弹性的应用程序管理。它的众多特性之一是支持通过其主要的二进制客户端 [kubectl][3] 运行定制脚本或可执行程序,kubectl 很强大的,允许用户在 Kubernetes 集群上用它直接做很多事情。 ### 使用别名进行 Kubernetes 的故障排查 -使用 Kubernetes 的容器管理的人都知道由于设计上原因带来了其复杂性。因此迫切的需要快速的以及几乎不需要人工干预方式简化故障排查(除过特殊情况)。 +使用 Kubernetes 进行容器编排的人都知道由于设计上原因带来了其功能的复杂性。举例说,迫切需要以更快的速度并且几乎不需要手动干预的方式来简化 Kubernetes 中的故障排除(除过特殊情况)。 -在故障排查功能方面,这有很多场景需要考虑。有一个场景,你知道你需要运行什么,但是这个命令的语法(即使作为一个单独的命令运行)过于复杂,或需要一、两次交互才能起作用。 +在故障排查功能方面,有很多场景需要考虑。在一种场景下,你知道你需要运行什么,但是这个命令的语法(即使作为一个单独的命令运行)过于复杂,或需要一、两次交互才能起作用。 -例如,如果你频繁的需要调整一个系统命名空间里正在运行的容器,你可能发现自己在重复的写入: +例如,如果你需要经常进入一个系统命名空间中运行的容器,你可能发现自己在重复地键入: ``` -`kubectl --namespace=kube-system exec -i -t ` -``` -为了简化故障排查,你可以用这些指令的命令行补全功能。比如,你可以增加下面命令到你的隐藏配置文件(.bashrc 或 .zshrc): - -``` -`alias ksysex='kubectl --namespace=kube-system exec -i -t'` +kubectl --namespace=kube-system exec -i -t ``` -这是来自于常见的 [Kubernetes 别名仓][4]的一个例子,它展示了一个 kubectl 简化的功能的方法。像这个场景的简化情况,使用别名很有用。 +为了简化故障排查,你可以用这些指令的命令行别名。比如,你可以增加下面命令到你的隐藏配置文件(`.bashrc` 或 `.zshrc`): + +``` +alias ksysex='kubectl --namespace=kube-system exec -i -t' +``` + +这是来自于 [Kubernetes 常见别名][4]存储库的一个例子,它展示了一种简化 `kubectl` 中的功能的方法。像这种场景下的简单情形,使用别名很有用。 ### 切换到 kubectl 插件 -更复杂的故障排查场景是需要执行很多命令,一个一个的执行,然后去调查环境,最后得出结论。单用别名方法是不能解决这种情况的;你需要知道你所部署的Kubernetes 之间逻辑和和相关性,你真是需要的是自动化来短时间输出你想要的。 +更复杂的故障排查场景是需要一个一个的执行很多命令,调查环境,最后得出结论。仅仅用别名方法是不能解决这种情况的;你需要知道你所部署的 Kubernetes 之间逻辑和相关性,你真正需要的是自动化,以在更短的时间内输出你想要的。 -考虑到你的集群有10到20或50到100个命名空间来提供不同的微服务。一般在进行故障排查时,做什么事情对你有帮助? +考虑到你的集群有 10 ~ 20 或 50 ~ 100 个命名空间来提供不同的微服务。一般在进行故障排查时,什么对你有帮助? - * 你需要某个东西可快速的告知哪个 Pod 哪个 命名空间抛的错误。 - * 你需要某个东西可监视一个命名空间的所有 pod 的日志。 - * 你可能也需要监视出现错误的指定命名空间的特定 pod 的日志。 +* 你需要能够快速分辨出抛出错误的是哪个 命名空间的哪个 Pod 的东西。 +* 你需要一些可监视一个命名空间的所有 Pod 日志的东西。 +* 你可能也需要监视特定命名空间的出现错误的某个 Pod 的日志。 +涵盖这些要点的解决方案对于定位生产环境的问题有很大的帮助,以及在开发和测试环节中也很有用。 -只要包含以上任意的解决方案将对定位产品问题很大的帮助,包含对开发和测试周期过程。 +你可以用 [kubectl 插件][5]创建比简单的别名更强大的功能。插件类似于其它用任何语言编写的独立脚本,但被设计为可以扩充 Kubernetes 管理员的主要命令。 -你可以用 [kubectl 插件][5] 创建比简易别名更强大的方法。插件类似于其他用任何语言编写的独立脚本,被设计为 Kubernetes 管理员的主要命令扩展。 - -创建一个插件,你必须用正确的语法 **kubectl-<your-plugin-name>** 来拷贝这个脚本到导出目录 **$PATH** ,需要赋予可执行权限(**chmod +x**)。 - -创建插件之后把他移动到你的目录,你需要立即运行。例如,你的目录下有一个 kubectl-krawl 和 kubectl-kmux: +创建一个插件,你必须用 `kubectl-` 的正确的语法来拷贝这个脚本到 `$PATH` 中的导出目录之一,并需要为其赋予可执行权限(`chmod +x`)。 +创建插件之后将其移动到路径中,你可以立即运行它。例如,我的路径下有一个 `kubectl-krawl` 和 `kubectl-kmux`: ``` $ kubectl plugin list @@ -63,80 +63,77 @@ The following compatible plugins are available: $ kubectl kmux ``` + 现在让我们见识下带有 tmux 的 Kubernetes 的有多强大。 ### 驾驭强大的 tmux -[Tmux][6] 是一个非常强大的工具,许多管理员和操作团队通过它来反馈问题故障,通过易于分屏的方式到窗口上并行调试多个机器以及管理日志。他的主要的优点是可基于命令行或自动化的脚本。 +[Tmux][6] 是一个非常强大的工具,许多管理员和运维团队都依赖它来解决与易操作性相关的问题:通过将窗口分成多个窗格以便在多台计算机上运行并行的调试来监视日志。它的主要的优点是可在命令行或自动化脚本中使用。 -我创建[一个 kubectl 插件][7] 用 tmux 使故障排查更加简单。我将通过注释来了解插件背后的逻辑(我们来瞅一瞅插件的整个源码): +我创建[一个 kubectl 插件][7],使用 tmux 使故障排查更加简单。我将通过注释来解析插件背后的逻辑(插件的完整代码留待给你实现): ``` -#NAMESPACE is namespace to monitor. -#POD is pod name -#Containers is container names +# NAMESPACE 是要监控的名字空间 +# POD 是 Pod 名称 +# Containers 是容器名称 -# initialize a counter n to count the number of loop counts, later be used by tmux to split panes. +# 初始化一个计数器 n 以计算循环计数的数量, +# 之后 tmux 使用它来拆分窗格。 n=0; -# start a loop on a list of pod and containers +# 在 Pod 和容器列表上开始循环 while IFS=' ' read -r POD CONTAINERS do + # tmux 为每个 Pod 创建一个新窗口 + tmux neww $COMMAND -n $POD 2>/dev/null + # 对运行中的 Pod 中 的所有容器启动循环 + for CONTAINER in ${CONTAINERS//,/ } + do + if [ x$POD = x -o x$CONTAINER = x ]; then + # 如果任何值为 null,则退出。 + warn "Looks like there is a problem getting pods data." + break + fi + + # 设置要执行的命令 + COMMAND=”kubectl logs -f $POD -c $CONTAINER -n $NAMESPACE” + # 检查 tmux 会话 + if tmux has-session -t <会话名> 2>/dev/null; + then + <设置会话退出> + else + <创建会话> + fi + # 在当前窗口为每个容器切分窗格 + tmux selectp -t $n \; \ + splitw $COMMAND \; \ + select-layout tiled \; + # 终止容器循环 + done + + # 用 Pod 名称重命名窗口以识别 + tmux renamew $POD 2>/dev/null + + # 增加计数器 + ((n+=1)) -           # tmux create the new window for each pod -            tmux neww $COMMAND -n $POD 2>/dev/null +# 终止 Pod 循环 +done<<(<从 kubernetes 集群获取 Pod 和容器的列表>) -           # start a loop for all containers inside a running pod -        for CONTAINER in ${CONTAINERS//,/ } -        do - -        if [ x$POD = x -o x$CONTAINER = x ]; then -        # if any of the values is null, exit. -        warn "Looks like there is a problem getting pods data." -        break -        fi -            -            # set the command to execute -        COMMAND=”kubectl logs -f $POD -c $CONTAINER -n $NAMESPACE” -        # check tmux session -        if tmux has-session -t <session name> 2>/dev/null; -        then -        <set session exists> -        else -        <create session> -        fi - -           # split planes in the current window for each containers -        tmux selectp -t $n \; \ -        splitw $COMMAND \; \ -        select-layout tiled \; - -           # end loop for containers -        done - -           # rename the window to identify by pod name -        tmux renamew $POD 2>/dev/null -        -            # increment the counter -        ((n+=1)) - -# end loop for pods -done< <(<fetch list of pod and containers from kubernetes cluster>) - -# finally select the window and attach session - tmux selectw -t <session name>:1 \; \ -  attach-session -t <session name>\; +# 最后选择窗口并附加会话 +tmux selectw -t <会话名>:1 \; \ +attach-session -t <会话名>\; ``` -运行插件脚本后,它将在当前目录会生成一个同名的镜像。每个 pod 有一个窗口,每个容器(如果有多个)被分割成不同 pos 窗口,日志以数据流形式输出。 漂亮的tmux 如下;如果配置正确,你将会看到哪个窗口是否处于激活运行状态(可看到标签是白色的)。 +运行插件脚本后,将产生类似于下图的输出。每个 Pod 有一个自己的窗口,每个容器(如果有多个)被分割到其窗口中 Pod 窗格中,并在日志到达时输出。Tmux 之美如下可见;通过正确的配置,你甚至会看到哪个窗口正处于激活运行状态(可看到标签是白色的)。 ![kmux 插件的输出][8] ### 总结 -别名是在 Kubernetes 环境下常见的也有用的简易故障排查方法。当环境变得复杂,用高级脚本生成的kubectl 插件是一个很强大的方法。至于用哪个编程语言来编写 kubectl 插件是没有限制。唯一的要求是路径命名是可执行的,并且不能与已知的 kubectl 命令重复。 +别名是在 Kubernetes 环境下常见的也有用的简易故障排查方法。当环境变得复杂,用高级脚本生成的kubectl 插件是一个更强大的方法。至于用哪个编程语言来编写 kubectl 插件是没有限制。唯一的要求是该名字在路径中是可执行的,并且不能与已知的 kubectl 命令重复。 -为了阅读完整的插件源码,我们尝试创建了一个插件,请查看我的 [kube-plugins-github][7] 仓。欢迎提交问题和补丁。 +要阅读完整的插件源码,或试试我创建的插件,请查看我的 [kube-plugins-github][7] 存储库。欢迎提交提案和补丁。 -------------------------------------------------------------------------------- @@ -144,8 +141,8 @@ via: https://opensource.com/article/20/2/kubernetes-tmux-kubectl 作者:[Abhishek Tamrakar][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/guevaraya) -校对:[校对者ID](https://github.com/校对者ID) +译者:[guevaraya](https://github.com/guevaraya) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -158,4 +155,4 @@ via: https://opensource.com/article/20/2/kubernetes-tmux-kubectl [5]: https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/ [6]: https://opensource.com/article/19/6/tmux-terminal-joy [7]: https://github.com/abhiTamrakar/kube-plugins -[8]: https://opensource.com/sites/default/files/uploads/kmux-output.png (Output of kmux plugin) +[8]: https://raw.githubusercontent.com/abhiTamrakar/kube-plugins/master/kmux/kmux.png From c9a1f4480067ad4740d6902ce0a1b28645d95e2e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 25 Feb 2020 12:56:08 +0800 Subject: [PATCH 079/260] PUB @guevaraya https://linux.cn/article-11930-1.html --- ...ubleshoot Kubernetes with the power of tmux and kubectl.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md (99%) diff --git a/translated/tech/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md b/published/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md similarity index 99% rename from translated/tech/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md rename to published/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md index 1f5a4e3ff6..8fe0552828 100644 --- a/translated/tech/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md +++ b/published/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (guevaraya) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11930-1.html) [#]: subject: (Troubleshoot Kubernetes with the power of tmux and kubectl) [#]: via: (https://opensource.com/article/20/2/kubernetes-tmux-kubectl) [#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) From 00562ca93f610a4ef789f1335d887c1ab283ccad Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Tue, 25 Feb 2020 20:32:26 +0800 Subject: [PATCH 080/260] Update 20200219 How to find what you-re looking for on Linux with find.md --- ... How to find what you-re looking for on Linux with find.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200219 How to find what you-re looking for on Linux with find.md b/sources/tech/20200219 How to find what you-re looking for on Linux with find.md index 3b0aa3ed68..9bcb73d4e5 100644 --- a/sources/tech/20200219 How to find what you-re looking for on Linux with find.md +++ b/sources/tech/20200219 How to find what you-re looking for on Linux with find.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (heguangzhi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -227,7 +227,7 @@ via: https://www.networkworld.com/article/3527420/how-to-find-what-you-re-lookin 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[heguangzhi](https://github.com/heguangzhi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b57b53943fb09d9b239e1585d03418323ce65ea2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 25 Feb 2020 20:34:27 +0800 Subject: [PATCH 081/260] APL --- sources/tech/20200224 Using C and C-- for data science.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200224 Using C and C-- for data science.md b/sources/tech/20200224 Using C and C-- for data science.md index 10cdb5e59f..c4fda5ba68 100644 --- a/sources/tech/20200224 Using C and C-- for data science.md +++ b/sources/tech/20200224 Using C and C-- for data science.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 231361b91e3a567eda06a3cef10b843dfefdffa9 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 25 Feb 2020 22:39:49 +0800 Subject: [PATCH 082/260] translate done: 20200129 Use Emacs to get social and track your todo list.md --- ... to get social and track your todo list.md | 162 ----------------- ... to get social and track your todo list.md | 165 ++++++++++++++++++ 2 files changed, 165 insertions(+), 162 deletions(-) delete mode 100644 sources/tech/20200129 Use Emacs to get social and track your todo list.md create mode 100644 translated/tech/20200129 Use Emacs to get social and track your todo list.md diff --git a/sources/tech/20200129 Use Emacs to get social and track your todo list.md b/sources/tech/20200129 Use Emacs to get social and track your todo list.md deleted file mode 100644 index 097f1919a3..0000000000 --- a/sources/tech/20200129 Use Emacs to get social and track your todo list.md +++ /dev/null @@ -1,162 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use Emacs to get social and track your todo list) -[#]: via: (https://opensource.com/article/20/1/emacs-social-track-todo-list) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Use Emacs to get social and track your todo list -====== -Access Twitter, Reddit, chat, email, RSS, and your todo list in the -nineteenth in our series on 20 ways to be more productive with open -source in 2020. -![Team communication, chat][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Doing (almost) all the things with Emacs, part 2 - -[Yesterday][2], I talked about how to read email, access your addresses, and show calendars in Emacs. Emacs has tons and tons of functionality, and you can also use it for Twitter, chatting, to-do lists, and more! - -![All the things with Emacs][3] - -To do all of this, you need to install some Emacs packages. As you did yesterday, open the Emacs package manager with **Meta**+**x package-manager** (Meta is **Alt** on most keyboards or **Option** on MacOS). Now select the following packages with **i**, then install them by typing **x**: - - -``` -nnreddit -todotxt -twittering-mode -``` - -Once they are installed, open **~/.emacs.d/init.el** with **Ctrl**+**x Ctrl**+**x**, and add the following before the **(custom-set-variables** line: - - -``` -;; Todo.txt -(require 'todotxt) -(setq todotxt-file (expand-file-name "~/.todo/todo.txt")) - -;; Twitter -(require 'twittering-mode) -(setq twittering-use-master-password t) -(setq twittering-icon-mode t) - -;; Python3 for nnreddit -(setq elpy-rpc-python-command "python3") -``` - -Save the file with **Ctrl**+**x Ctrl**+**a**, exit Emacs with **Ctrl**+**x Ctrl**+**c**, then restart Emacs. - -#### Tweet from Emacs with twittering-mode - -![Twitter in Emacs][4] - -[Twittering-mode][5] is one of the best Emacs interfaces for Twitter. It supports almost all the features of Twitter and has some easy-to-use keyboard shortcuts. - -To get started, type **Meta**+**x twit** to launch twittering-mode. It will give a URL to open—and prompt you to launch a browser with it if you want—so you can log in and get an authorization token. Copy and paste the token into Emacs, and your Twitter timeline should load. You can scroll with the **Arrow** keys, use **Tab** to move from item to item, and press **Enter** to view the URL the cursor is on. If the cursor is on a username, pressing **Enter** will open that timeline in a web browser. If you are on a tweet's text, pressing **Enter** will reply to that tweet. You can create a new tweet with **u**, retweet something with **Ctrl**+**c**+**Enter**, and send a direct message with **d**—the dialog it opens has instructions on how to send, cancel, and shorten URLs. - -Pressing **V** will open a prompt to get to other timelines. To open your mentions, type **:mentions**. The home timeline is **:home**, and typing a username will take you to that user's timeline. Finally, pressing **q** will quit twittering-mode and close the window. - -There is a lot more functionality available in twittering-mode, and I encourage you to read the [full list][6] on its GitHub page. - -#### Track your to-do's in Emacs with Todotxt.el - -![todo.txt in emacs][7] - -[Todotxt.el][8] is a nice interface for the [todo.txt][9] to-do list manager. It has hotkeys for just about everything. - -To start it up, type **Meta**+**x todotxt**, and it will load the todo.txt file you specified in the **todotxt-file** variable (which you set in the first part of this article). Inside the buffer (window) for todo.txt, you can press **a** to add a new task and **c** to mark it complete. You can set priorities with **r**, and add projects and context to an item with **t**. When you are ready to move everything to **done.txt**, just press **A**. And you can filter the list with **/** or refresh back to the full list with **l**. And again, you can press **q** to exit. - -#### Chat in Emacs with ERC - -![Chatting with erc][10] - -One of Vim's shortcomings is that trying to use chat with it is difficult (at best). Emacs, on the other hand, has the [ERC][11] client built into the default distribution. Start ERC with **Meta**+**x erc**, and you will be prompted for a server name, username, and password. You can use the same information you used a few days ago when you set up [BitlBee][12]: server **localhost**, port **6667**, and the same username with no password. It should be the same as using almost any other IRC client. Each channel will be split into a new buffer (window), and you can switch between them with **Ctrl**+**x Ctrl**+**b**, which also switches between other buffers in Emacs. The **/quit** command will exit ERC. - -#### Read email, Reddit, and RSS feeds with Gnus - -![Mail, Reddit, and RSS feeds with Gnus][13] - -I'm sure many long-time Emacs users were asking, "but what about [Gnus][14]?" yesterday when I was talking about reading mail in Emacs. And it's a valid question. Gnus is a mail and newsreader built into Emacs, although it doesn't support [Notmuch][15] as a mail reader, just as a search engine. However, if you are configuring it for Reddit and RSS feeds (as you'll do in a moment), it's smart to add in mail functionality as well. - -Gnus was created for reading Usenet News and grew from there. So, a lot of its look and feel (and terminology) seem a lot like a Usenet newsreader. - -Gnus has its own configuration file in **~/.gnus** (the configuration can also be included in the main **~/.emacs.d/init.el**). Open **~/.gnus** with **Ctrl**+**x Ctrl**+**f** and add the following: - - -``` -;; Required packages -(require 'nnir) -(require 'nnrss) - -;; Primary Mailbox -(setq gnus-select-method -      '(nnmaildir "Local" -                  (directory "~/Maildir") -                  (nnir-search-engine notmuch) -      )) -(add-to-list 'gnus-secondary-select-methods -             '(nnreddit "")) -``` - -Save the file with **Ctrl**+**x Ctrl**+**s**. This tells Gnus to read mail from the local mailbox in **~/Maildir** as the primary source (**gnus-select-method**) and add a second source (**gnus-secondary-select-methods**) using the [nnreddit][16] plugin. You can also define multiple secondary sources, including Usenet News (nntp), IMAP (nnimap), mbox (nnmbox), and virtual collections (nnvirtual). You can learn more about all the options in the [Gnus manual][17]. - -Once you save the file, start Gnus with **Meta**+**x gnus**. The first run will install [Reddit Terminal Viewer][18] in a Python virtual environment, which is how it gets Reddit articles. It will then launch your browser to log into Reddit. After that, it will scan and load your subscribed Reddit groups. You will see a list of email folders with new mail and the list of subreddits with new content. Pressing **Enter** on any of them will load the list of messages for the group. You can navigate with the **Arrow** keys and press **Enter** to load and read a message. Pressing **q** will go back to the prior view when viewing message lists, and pressing **q** from the main window will exit Gnus. When reading a Reddit group, **a** creates a new message; in a mail group, **m** creates a new email; and **r** replies to messages in either view. - -You can also add RSS feeds to the Gnus interface and read them like mail and newsgroups. To add an RSS feed, type **G**+**R** and fill in the RSS feed's URL. You will be prompted for the title and description of the feed, which should be auto-filled from the feed. Now type **g** to check for new messages (this checks for new messages in all groups). Reading a feed is like reading Reddit groups and mail, so it uses the same keys. - -There is a _lot_ of functionality in Gnus, and there are a whole lot more key combinations. The [Gnus Reference Card][19] lists all of them for each view (on five pages in very small type). - -#### See your position with nyan-mode - -As a final note, you might notice [Nyan cat][20] at the bottom of some of my screenshots. This is [nyan-mode][21], which indicates where you are in a buffer, so it gets longer as you get closer to the bottom of a document or buffer. You can install it with the package manager and set it up with the following code in **~/.emacs.d/init.el**: - - -``` -;; Nyan Cat -(setq nyan-wavy-trail t) -(setq nyan-bar-length 20) -(nyan-mode) -``` - -### Scratching Emacs' surface - -This is just scratching the surface of all the things you can do with Emacs. It is _very_ powerful, and it is one of my go-to tools for being productive whether I'm tracking to-dos, reading and responding to mail, editing text, or chatting with my friends and co-workers. It takes a bit of getting used to, but once you do, it can become one of the most useful tools on your desktop. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/emacs-social-track-todo-list - -作者:[Kevin Sonney][a] -选题:[lujun9972][b] -译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) -[2]: https://opensource.com/article/20/1/emacs-mail-calendar -[3]: https://opensource.com/sites/default/files/uploads/productivity_19-1.png (All the things with Emacs) -[4]: https://opensource.com/sites/default/files/uploads/productivity_19-2.png (Twitter in Emacs) -[5]: https://github.com/hayamiz/twittering-mode -[6]: https://github.com/hayamiz/twittering-mode#features -[7]: https://opensource.com/sites/default/files/uploads/productivity_19-3.png (todo.txt in emacs) -[8]: https://github.com/rpdillon/todotxt.el -[9]: http://todotxt.org/ -[10]: https://opensource.com/sites/default/files/uploads/productivity_19-4.png (Chatting with erc) -[11]: https://www.gnu.org/software/emacs/manual/html_mono/erc.html -[12]: https://opensource.com/article/20/1/open-source-chat-tool -[13]: https://opensource.com/sites/default/files/uploads/productivity_19-5.png (Mail, Reddit, and RSS feeds with Gnus) -[14]: https://www.gnus.org/ -[15]: https://opensource.com/article/20/1/organize-email-notmuch -[16]: https://github.com/dickmao/nnreddit -[17]: https://www.gnus.org/manual/gnus.html -[18]: https://pypi.org/project/rtv/ -[19]: https://www.gnu.org/software/emacs/refcards/pdf/gnus-refcard.pdf -[20]: http://www.nyan.cat/ -[21]: https://github.com/TeMPOraL/nyan-mode diff --git a/translated/tech/20200129 Use Emacs to get social and track your todo list.md b/translated/tech/20200129 Use Emacs to get social and track your todo list.md new file mode 100644 index 0000000000..fff71fcc19 --- /dev/null +++ b/translated/tech/20200129 Use Emacs to get social and track your todo list.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Emacs to get social and track your todo list) +[#]: via: (https://opensource.com/article/20/1/emacs-social-track-todo-list) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Emacs 进行社交并跟踪你的待办事项列表 +====== +访问 Twitter、Reddit、 交谈、电子邮件 、RSS 和你的待办事项列表,这是我们关于 2020 年使用开源提高效率的 20 个方法系列的第 19 个。 +![团队沟通、交谈 ][1] + +去年,我给你们带来了 2019 年的 19 天新生产力工具。今年,我将采取一种不同的方法:建立一个新的环境,让你使用已用或未用的工具在新的一年里更有效率,。 + +### 使用 Emacs 做(几乎)所有的事情,第 2 部分 + +[昨天 ][2],我谈到了如何在 Emacs 中读取电子邮件、访问电子邮件地址和显示日历。Emacs 功能繁多,你还可以将它用于 Twitter、 交谈、待办事项列表等等! + +[在 Emacs 中处理所有事情 ][3] + +要完成所有这些,您需要安装一些 Emacs 包。和昨天一样,用 `Meta+x package-manager` 打开 Emacs 包管理器 (Meta 在大多数键盘上是 **Alt**,在 MacOS 上是 **Option**)。然后通过 **i** 选择以下带有的软件包,然后输入 **x** 进行安装: + + +``` +nnreddit +todotxt +twittering-mode +``` + +安装之后,按下 `Ctrl+x ctrl+f` 打开 `~/.emacs.d/init.el`,并在 `(custom-set-variables` 行前加上: + + +``` +;; Todo.txt +(require 'todotxt) +(setq todotxt-file (expand-file-name "~/.todo/todo.txt")) + +;; Twitter +(require 'twittering-mode) +(setq twittering-use-master-password t) +(setq twittering-icon-mode t) + +;; Python3 for nnreddit +(setq elpy-rpc-python-command "python3") +``` + +按下 `Ctrl+x Ctrl+s` 保存文件,使用 `Ctrl+x Ctrl+c` 退出 Emacs,然后重启 Emacs。 + +#### 使用 twittering-mode 在 Emacs 中发推 + +![Emacs 中的 Twitter][4] + +[Twittering-mode][5] 是 Twitter 最好的 Emacs 接口之一。它几乎支持 Twitter 的所有功能,并且键盘快捷键也易于使用。 + +首先,输入 `Meta+x twit` 来启动 twitter-mode。它会提供一个 URL 并提示你启动浏览器来访问它,你登录该 URL 后就能获得授权令牌。将令牌复制并粘贴到 Emacs 中,您的 Twitter 时间线就会加载了。您可以使用**箭头**键滚动,使用 **Tab** 从一个项目移动到另一个项目,并按 **Enter** 访问光标所在的 URL。如果光标在用户名上,按 **Enter** 将在 web 浏览器中打开时间轴。如果你在一条 tweet 的文本上,按 **Enter** 将回复该 tweet。你可以用 **u** 创建一个新的 tweet,用 `Ctrl+c+Enter` 转发一些内容,然后用 **d** 发送一条直接消息——它打开的对话框中有关于如何发送、取消和缩短 url 的说明。 + +按 **V** 会打开一个提示让你跳转到其他时间线。输入 **:mentions** 打开你的提及。输入 **:home** 打开你的主时间线,输入用户名将进入该用户的时间线。最后,按 **q** 会退出 twittering-mode 并关闭窗口。 + +twitter-mode 还有更多功能,我鼓励你阅读它 GitHub 页面上的[完整功能列表 ][6]。 + +#### 在 Emacs 上使用 Todotxt.el 追踪你的待办事项 + +![Emacs 中的 todo.txt][7] + +[Todotxt.el][8] 是一个很棒的 [todo.txt][9] 待办列表管理器接口。它的快捷键几乎无所不包。 + +输入 `Meta+x todotxt` 启动它将加载 **todotxt-file** 变量中指定的 todo.txt 文件(本文的第一部分中设置了该文件)。 +在 todo.txt 的缓冲区(窗口*,您可以按 **a** 添加新任务并和按 **c** 标记它已被完成。你还可以使用 **r** 设置优先级,并使用 **t** 添加项目和上下文。 +完成事项后只需要按下 **A** 即可将任务移如 **done.txt**。你可以使用**/**过滤列表,也可以使用 **l** 刷新完整列表。同样,您可以按 **q** 退出。 + +#### 在 Emacs 中使用 ERC 进行交谈 + +![使用 ERC 与人交谈 ][10] + +Vim 的缺点之一是很难用它与人交谈。另一方面,Emacs 则将 [ERC][11] 客户端内置到默认发行版中。使用 `Meta+x ERC` 启动 ERC,系统将提示您输入服务器、用户名和密码。你可以使用几天前介绍设置 [BitlBee][12] 时使用的相同信息:服务器为 **localhost**,端口为 **6667**,相同用户名,无需密码。 +ERC 使用起来与其他 IRC 客户端一样。每个频道单独一个缓冲区(窗口),您可以使用 `Ctrl+x ctrl+b` 进行频道间切换,这也可以在 Emacs 中的其他缓冲区之间进行切换。`/quit` 命令将退出 ERC。 + +#### 使用 Gnus 阅读电子邮件,Reddit 和 RSS + +![Mail,Reddit,and RSS feeds with Gnus][13] + +我相信昨天在我提及在 Emacs 中阅读邮件时,许多 Emacs 的老用户会问,“怎么没有 [Gnus][14] 呢?” +这个疑问很合理。Gnus 是一个内置在 Emacs 中的邮件和新闻阅读器,尽管它这个邮件阅读器不支持以 [Notmuch][15] 作为搜索引擎。但是,如果你将其配置来阅读 Reddit 和 RSS feed( 稍后您将这样做),那么同时使用它来阅读邮件是个聪明的选择。 + +Gnus 是为阅读 Usenet 新闻而创建的,并从此发展而来。因此,它的很多外观和感觉(以及术语)看起来很像 Usenet 的新闻阅读器。 + +Gnus 以 `~/.gnus` 作为自己的配置文件。(该配置也可以包含在 `~/.emacs.d/init.el` 中)。使用 `Ctrl+x Ctrl+f` 打开 `~/.gnus`,并添加以下内容: + + +``` +;; Required packages +(require 'nnir) +(require 'nnrss) + +;; Primary Mailbox +(setq gnus-select-method +      '(nnmaildir "Local" +                  (directory "~/Maildir") +                  (nnir-search-engine notmuch) +      )) +(add-to-list 'gnus-secondary-select-methods +             '(nnreddit "")) +``` + +用 `Ctrl+x Ctrl+s` 保存文件。这分配置告诉 Gnus 从 `~/Maildir` 这个本地邮箱中读取邮件作为主源(参见 **gnus-select-method** 变量),并使用 [nnreddit][16] 插件添加辅源 (**gnus-secondary-select-methods** 变量)。你还可以定义多个辅助源,包括 Usenet 新闻 (nntp)、IMAP (nnimap)、mbox (nnmbox) 和虚拟集合 (nnvirtual)。您可以在 [Gnus 手册 ][17] 中了解更多有关所有选项的信息。 + +保存文件后,使用 `Meta+x Gnus` 启动 Gnus。第一次运行将在 Python 虚拟环境中安装 [Reddit 终端查看器 ][18],Gnus 通过它获取 Reddit 上的文章。然后它会启动浏览器来登录 Reddit。之后,它会扫描并加载你订阅的 Reddit 群组。你会看到一个有新邮件的邮件夹列表和一个有新内容的看板列表。在任一列表上按 **Enter** 将加载该组中的消息列表。您可以使用**箭头**键导航并按 **Enter** 加载和读取消息。在查看消息列表时,按 **q** 将返回到前一个视图,从主窗口按 **q** 将退出 Gnus。在阅读 Reddit 群组时,**a** 会创建一条新消息;在邮件组中,**m** 创建一个新的电子邮件;并且在任何一个视图中按 **r** 回复邮件。 + +您还可以向 Gnus 接口中添加 RSS feed,并像阅读邮件和新闻组一样阅读它们。要添加 RSS feed,输入 `G+R` 并填写 RSS feed 的 URL。会有提示让你输入 feed 的标题和描述,这些信息可以从 feed 中提取出来并填充进去。现在输入 **g** 来检查新消息(这将检查所有组中的新消息)。阅读 feed 就像阅读 Reddit 群组和邮件一样,它们使用相同的快捷键。 + +Gnus 中有_很多_功能,还有大量的键组合。[Gnus 参考卡 ][19] 为每个视图列出了所有这些键组合(以非常小的字体显示在 5 页纸上)。 + +#### 使用 nyan-mode 查看位置 + +As a final note,you might notice [Nyan cat][20] at the bottom of some of my screenshots。This is [nyan-mode][21],which indicates where you are in a buffer,so it gets longer as you get closer to the bottom of a document or buffer。You can install it with the package manager and set it up with the following code in **~/.emacs.d/init.el**: +最后,你可能会一些截屏底部注意到 [Nyan cat][20]。这是 [nyan-mode][21],它指示了你在缓冲区中的位置,因此当您接近文档或缓冲区的底部时,它会变长。您可以使用包管理器安装它,并在 `~/.emacs.d/init.el` 中使用以下代码进行设置: + + +``` +;; Nyan Cat +(setq nyan-wavy-trail t) +(setq nyan-bar-length 20) +(nyan-mode) +``` + +### Emacs 的皮毛 + +这只是 Emacs 所有功能的皮毛。Emacs_ 非常_强大,是我用来提高工作效率的必要工具之一,无论我是在追踪待办事项、阅读和回复邮件、编辑文本,还是与朋友和同事交流我都用它。这需要一点时间来适应,但是一旦你习惯了,它就会成为你桌面上最有用的工具之一。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/emacs-social-track-todo-list + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) +[2]: https://opensource.com/article/20/1/emacs-mail-calendar +[3]: https://opensource.com/sites/default/files/uploads/productivity_19-1.png (All the things with Emacs) +[4]: https://opensource.com/sites/default/files/uploads/productivity_19-2.png (Twitter in Emacs) +[5]: https://github.com/hayamiz/twittering-mode +[6]: https://github.com/hayamiz/twittering-mode#features +[7]: https://opensource.com/sites/default/files/uploads/productivity_19-3.png (todo.txt in emacs) +[8]: https://github.com/rpdillon/todotxt.el +[9]: http://todotxt.org/ +[10]: https://opensource.com/sites/default/files/uploads/productivity_19-4.png (Chatting with erc) +[11]: https://www.gnu.org/software/emacs/manual/html_mono/erc.html +[12]: https://opensource.com/article/20/1/open-source-chat-tool +[13]: https://opensource.com/sites/default/files/uploads/productivity_19-5.png (Mail, Reddit, and RSS feeds with Gnus) +[14]: https://www.gnus.org/ +[15]: https://opensource.com/article/20/1/organize-email-notmuch +[16]: https://github.com/dickmao/nnreddit +[17]: https://www.gnus.org/manual/gnus.html +[18]: https://pypi.org/project/rtv/ +[19]: https://www.gnu.org/software/emacs/refcards/pdf/gnus-refcard.pdf +[20]: http://www.nyan.cat/ +[21]: https://github.com/TeMPOraL/nyan-mode From 7eee3a2aee70e1ee8649dbd75948437a32c2fda9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 25 Feb 2020 23:22:50 +0800 Subject: [PATCH 083/260] TSL PART 1 --- ...200224 Using C and C-- for data science.md | 747 ------------------ ...200224 Using C and C-- for data science.md | 525 ++++++++++++ 2 files changed, 525 insertions(+), 747 deletions(-) delete mode 100644 sources/tech/20200224 Using C and C-- for data science.md create mode 100644 translated/tech/20200224 Using C and C-- for data science.md diff --git a/sources/tech/20200224 Using C and C-- for data science.md b/sources/tech/20200224 Using C and C-- for data science.md deleted file mode 100644 index c4fda5ba68..0000000000 --- a/sources/tech/20200224 Using C and C-- for data science.md +++ /dev/null @@ -1,747 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Using C and C++ for data science) -[#]: via: (https://opensource.com/article/20/2/c-data-science) -[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) - -Using C and C++ for data science -====== -Let's work through common data science task with C99 and C++11. -![metrics and data shown on a computer screen][1] - -While languages like [Python][2] and [R][3] are increasingly popular for data science, C and C++ can be a strong choice for efficient and effective data science. In this article, we will use [C99][4] and [C++11][5] to write a program that uses the [Anscombe’s quartet][6] dataset, which I'll explain about next. - -I wrote about my motivation for continually learning languages in an article covering [Python and GNU Octave][7], which is worth reviewing. All of the programs are meant to be run on the [command line][8], not with a [graphical user interface][9] (GUI). The full examples are available in the [polyglot_fit repository][10]. - -### The programming task - -The program you will write in this series: - - * Reads data from a [CSV file][11] - * Interpolates the data with a straight line (i.e., _f(x)=m ⋅ x + q_) - * Plots the result to an image file - - - -This is a common situation that many data scientists have encountered. The example data is the first set of [Anscombe's quartet][6], shown in the table below. This is a set of artificially constructed data that gives the same results when fitted with a straight line, but their plots are very different. The data file is a text file with tabs as column separators and a few lines as a header. This task will use only the first set (i.e., the first two columns). - -[**Anscombe's quartet**][6] - -I - -II - -III - -IV - -x - -y - -x - -y - -x - -y - -x - -y - -10.0 - -8.04 - -10.0 - -9.14 - -10.0 - -7.46 - -8.0 - -6.58 - -8.0 - -6.95 - -8.0 - -8.14 - -8.0 - -6.77 - -8.0 - -5.76 - -13.0 - -7.58 - -13.0 - -8.74 - -13.0 - -12.74 - -8.0 - -7.71 - -9.0 - -8.81 - -9.0 - -8.77 - -9.0 - -7.11 - -8.0 - -8.84 - -11.0 - -8.33 - -11.0 - -9.26 - -11.0 - -7.81 - -8.0 - -8.47 - -14.0 - -9.96 - -14.0 - -8.10 - -14.0 - -8.84 - -8.0 - -7.04 - -6.0 - -7.24 - -6.0 - -6.13 - -6.0 - -6.08 - -8.0 - -5.25 - -4.0 - -4.26 - -4.0 - -3.10 - -4.0 - -5.39 - -19.0 - -12.50 - -12.0 - -10.84 - -12.0 - -9.13 - -12.0 - -8.15 - -8.0 - -5.56 - -7.0 - -4.82 - -7.0 - -7.26 - -7.0 - -6.42 - -8.0 - -7.91 - -5.0 - -5.68 - -5.0 - -4.74 - -5.0 - -5.73 - -8.0 - -6.89 - -### The C way - -[C][12] is a general-purpose programming language that is among the most popular languages in use today (according to data from the [TIOBE Index][13], [RedMonk Programming Language Rankings][14], [Popularity of Programming Language Index][15], and [State of the Octoverse of GitHub][16]). It is a quite old language (circa 1973), and many successful programs were written in it (e.g., the Linux kernel and Git to name just two). It is also one of the closest languages to the inner workings of the computer, as it is used to manipulate memory directly. It is a [compiled language][17]; therefore, the source code has to be translated by a [compiler][18] into [machine code][19]. Its [standard library][20] is small and light on features, so other libraries have been developed to provide missing functionalities. - -It is the language I use the most for [number crunching][21], mostly because of its performance. I find it rather tedious to use, as it needs a lot of [boilerplate code][22], but it is well supported in various environments. The C99 standard is a recent revision that adds some nifty features and is well supported by compilers. - -I will cover the necessary background of C and C++ programming along the way so both beginners and advanced users can follow along.   - -#### Installation - -To develop with C99, you need a compiler. I normally use [Clang][23], but [GCC][24] is another valid open source compiler. For linear fitting, I chose to use the [GNU Scientific Library][25]. For plotting, I could not find any sensible library, and therefore this program relies on an external program: [Gnuplot][26]. The example also uses a dynamic data structure to store data, which is defined in the [Berkeley Software Distribution][27] (BSD). - -Installing in [Fedora][28] is as easy as running: - - -``` -`sudo dnf install clang gnuplot gsl gsl-devel` -``` - -#### Commenting code - -In C99, [comments][29] are formatted by putting **//** at the beginning of the line, and the rest of the line will be discarded by the interpreter. Alternatively, anything between **/*** and ***/** is discarded, as well. - - -``` -// This is a comment ignored by the interpreter. -/* Also this is ignored */ -``` - -#### Necessary libraries - -Libraries are composed of two parts: - - * A [header file][30] that contains a description of the functions - * A source file that contains the functions' definitions - - - -Header files are included in the source, while the libraries' sources are [linked][31] against the executable. Therefore, the header files needed for this example are: - - -``` -// Input/Output utilities -#include <stdio.h> -// The standard library -#include <stdlib.h> -// String manipulation utilities -#include <string.h> -// BSD queue -#include <sys/queue.h> -// GSL scientific utilities -#include <gsl/gsl_fit.h> -#include <gsl/gsl_statistics_double.h> -``` - -#### Main function - -In C, the program must be inside a special function called **[main()][32]:** - - -``` -int main(void) { -    ... -} -``` - -This differs from Python, as covered in the last tutorial, which will run whatever code it finds in the source files. - -#### Defining variables - -In C, variables have to be declared before they are used, and they have to be associated with a type. Whenever you want to use a variable, you have to decide what kind of data to store in it. You can also specify if you intend to use a variable as a constant value, which is not necessary, but the compiler can benefit from this information. From the [fitting_C99.c program][33] in the repository: - - -``` -const char *input_file_name = "anscombe.csv"; -const char *delimiter = "\t"; -const unsigned int skip_header = 3; -const unsigned int column_x = 0; -const unsigned int column_y = 1; -const char *output_file_name = "fit_C99.csv"; -const unsigned int N = 100; -``` - -Arrays in C are not dynamic, in the sense that their length has to be decided in advance (i.e., before compilation): - - -``` -`int data_array[1024];` -``` - -Since you normally do not know how many data points are in a file, use a [singly linked list][34]. This is a dynamic data structure that can grow indefinitely. Luckily, the BSD [provides linked lists][35]. Here is an example definition: - - -``` -struct data_point { -    double x; -    double y; - -    SLIST_ENTRY(data_point) entries; -}; - -SLIST_HEAD(data_list, data_point) head = SLIST_HEAD_INITIALIZER(head); -SLIST_INIT(&head); -``` - -This example defines a **data_point** list comprised of structured values that contain both an **x** value and a **y** value. The syntax is rather complicated but intuitive, and describing it in detail would be too wordy. - -#### Printing output - -To print on the terminal, you can use the [**printf()**][36] function, which works like Octave's **printf()** function (described in the first article): - - -``` -`printf("#### Anscombe's first set with C99 ####\n");` -``` - -The **printf()** function does not automatically add a newline at the end of the printed string, so you have to add it. The first argument is a string that can contain format information for the other arguments that can be passed to the function, such as: - - -``` -`printf("Slope: %f\n", slope);` -``` - -#### Reading data - -Now comes the hard part… There are some libraries for CSV file parsing in C, but none seemed stable or popular enough to be in the Fedora packages repository. Instead of adding a dependency for this tutorial, I decided to write this part on my own. Again, going into details would be too wordy, so I will only explain the general idea. Some lines in the source will be ignored for the sake of brevity, but you can find the complete example in the repository. - -First, open the input file: - - -``` -`FILE* input_file = fopen(input_file_name, "r");` -``` - -Then read the file line-by-line until there is an error or the file ends: - - -``` -while (![ferror][37](input_file) && ![feof][38](input_file)) { -    size_t buffer_size = 0; -    char *buffer = NULL; -    -    getline(&buffer, &buffer_size, input_file); - -    ... -} -``` - -The [**getline()**][39] function is a nice recent addition from the [POSIX.1-2008 standard][40]. It can read a whole line in a file and take care of allocating the necessary memory. Each line is then split into [tokens][41] with the [**strtok()**][42] function. Looping over the token, select the columns that you want: - - -``` -char *token = [strtok][43](buffer, delimiter); - -while (token != NULL) -{ -    double value; -    [sscanf][44](token, "%lf", &value); - -    if (column == column_x) { -        x = value; -    } else if (column == column_y) { -        y = value; -    } - -    column += 1; -    token = [strtok][43](NULL, delimiter); -} -``` - -Finally, when the **x** and **y** values are selected, insert the new data point in the linked list: - - -``` -struct data_point *datum = [malloc][45](sizeof(struct data_point)); -datum->x = x; -datum->y = y; - -SLIST_INSERT_HEAD(&head, datum, entries); -``` - -The [**malloc()**][46] function dynamically allocates (reserves) some persistent memory for the new data point. - -#### Fitting data - -The GSL linear fitting function [**gsl_fit_linear()**][47] expects simple arrays for its input. Therefore, since you won't know in advance the size of the arrays you create, you must manually allocate their memory: - - -``` -const size_t entries_number = row - skip_header - 1; - -double *x = [malloc][45](sizeof(double) * entries_number); -double *y = [malloc][45](sizeof(double) * entries_number); -``` - -Then, loop over the linked list to save the relevant data to the arrays: - - -``` -SLIST_FOREACH(datum, &head, entries) { -    const double current_x = datum->x; -    const double current_y = datum->y; - -    x[i] = current_x; -    y[i] = current_y; - -    i += 1; -} -``` - -Now that you are done with the linked list, clean it up. _Always_ release the memory that has been manually allocated to prevent a [memory leak][48]. Memory leaks are bad, bad, bad. Every time memory is not released, a garden gnome loses its head: - - -``` -while (!SLIST_EMPTY(&head)) { -    struct data_point *datum = SLIST_FIRST(&head); - -    SLIST_REMOVE_HEAD(&head, entries); - -    [free][49](datum); -} -``` - -Finally, finally(!), you can fit your data: - - -``` -gsl_fit_linear(x, 1, y, 1, entries_number, -               &intercept, &slope, -               &cov00, &cov01, &cov11, &chi_squared); -const double r_value = gsl_stats_correlation(x, 1, y, 1, entries_number); - -[printf][50]("Slope: %f\n", slope); -[printf][50]("Intercept: %f\n", intercept); -[printf][50]("Correlation coefficient: %f\n", r_value); -``` - -#### Plotting - -You must use an external program for the plotting. Therefore, save the fitting function to an external file: - - -``` -const double step_x = ((max_x + 1) - (min_x - 1)) / N; - -for (unsigned int i = 0; i < N; i += 1) { -    const double current_x = (min_x - 1) + step_x * i; -    const double current_y = intercept + slope * current_x; - -    [fprintf][51](output_file, "%f\t%f\n", current_x, current_y); -} -``` - -The Gnuplot command for plotting both files is: - - -``` -`plot 'fit_C99.csv' using 1:2 with lines title 'Fit', 'anscombe.csv' using 1:2 with points pointtype 7 title 'Data'` -``` - -#### Results - -Before running the program, you must compile it: - - -``` -`clang -std=c99 -I/usr/include/ fitting_C99.c -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_C99` -``` - -This command tells the compiler to use the C99 standard, read the **fitting_C99.c** file, load the libraries **gsl** and **gslcblas**, and save the result to **fitting_C99**. The resulting output on the command line is: - - -``` -#### Anscombe's first set with C99 #### -Slope: 0.500091 -Intercept: 3.000091 -Correlation coefficient: 0.816421 -``` - -Here is the resulting image generated with Gnuplot. - -![Plot and fit of the dataset obtained with C99][52] - -### The C++11 way - -[C++][53] is a general-purpose programming language that is also among the most popular languages in use today. It was created as a [successor of C][54] (in 1983) with an emphasis on [object-oriented programming][55] (OOP). C++ is commonly regarded as a superset of C, so a C program should be able to be compiled with a C++ compiler. This is not exactly true, as there are some corner cases where they behave differently. In my experience, C++ needs less boilerplate than C, but the syntax is more difficult if you want to develop objects. The C++11 standard is a recent revision that adds some nifty features and is more or less supported by compilers. - -Since C++ is largely compatible with C, I will just highlight the differences between the two. If I do not cover a section in this part, it means that it is the same as in C. - -#### Installation - -The dependencies for the C++ example are the same as the C example. On Fedora, run: - - -``` -`sudo dnf install clang gnuplot gsl gsl-devel` -``` - -#### Necessary libraries - -Libraries work in the same way as in C, but the **include** directives are slightly different: - - -``` -#include <cstdlib> -#include <cstring> -#include <iostream> -#include <fstream> -#include <string> -#include <vector> -#include <algorithm> - -extern "C" { -#include <gsl/gsl_fit.h> -#include <gsl/gsl_statistics_double.h> -} -``` - -Since the GSL libraries are written in C, you must inform the compiler about this peculiarity. - -#### Defining variables - -C++ supports more data types (classes) than C, such as a **string** type that has many more features than its C counterpart. Update the definition of the variables accordingly: - - -``` -`const std::string input_file_name("anscombe.csv");` -``` - -For structured objects like strings, you can define the variable without using the **=** sign. - -#### Printing output - -You can use the **printf()** function, but the **cout** object is more idiomatic. Use the operator **<<** to indicate the string (or objects) that you want to print with **cout**: - - -``` -std::cout << "#### Anscombe's first set with C++11 ####" << std::endl; - -... - -std::cout << "Slope: " << slope << std::endl; -std::cout << "Intercept: " << intercept << std::endl; -std::cout << "Correlation coefficient: " << r_value << std::endl; -``` - -#### Reading data - -The scheme is the same as before. The file is opened and read line-by-line, but with a different syntax: - - -``` -std::ifstream input_file(input_file_name); - -while (input_file.good()) { -    std::string line; - -    getline(input_file, line); - -    ... -} -``` - -The line tokens are extracted with the same function as in the C99 example. Instead of using standard C arrays, use two [vectors][56]. Vectors are an extension of C arrays in the [C++ standard library][57] that allows dynamic management of memory without explicitly calling **malloc()**: - - -``` -std::vector<double> x; -std::vector<double> y; - -// Adding an element to x and y: -x.emplace_back(value); -y.emplace_back(value); -``` - -#### Fitting data - -For fitting in C++, you do not have to loop over the list, as vectors are guaranteed to have contiguous memory. You can directly pass to the fitting function the pointers to the vectors buffers: - - -``` -gsl_fit_linear(x.data(), 1, y.data(), 1, entries_number, -               &intercept, &slope, -               &cov00, &cov01, &cov11, &chi_squared); -const double r_value = gsl_stats_correlation(x.data(), 1, y.data(), 1, entries_number); - -std::cout << "Slope: " << slope << std::endl; -std::cout << "Intercept: " << intercept << std::endl; -std::cout << "Correlation coefficient: " << r_value << std::endl; -``` - -#### Plotting - -Plotting is done with the same approach as before. Write to a file: - - -``` -const double step_x = ((max_x + 1) - (min_x - 1)) / N; - -for (unsigned int i = 0; i < N; i += 1) { -    const double current_x = (min_x - 1) + step_x * i; -    const double current_y = intercept + slope * current_x; - -    output_file << current_x << "\t" << current_y << std::endl; -} - -output_file.close(); -``` - -And then use Gnuplot for the plotting. - -#### Results - -Before running the program, it must be compiled with a similar command: - - -``` -`clang++ -std=c++11 -I/usr/include/ fitting_Cpp11.cpp -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_Cpp11` -``` - -The resulting output on the command line is: - - -``` -#### Anscombe's first set with C++11 #### -Slope: 0.500091 -Intercept: 3.00009 -Correlation coefficient: 0.816421 -``` - -And this is the resulting image generated with Gnuplot. - -![Plot and fit of the dataset obtained with C++11][58] - -### Conclusion - -This article provides examples for a data fitting and plotting task in C99 and C++11. Since C++ is largely compatible with C, this article exploited their similarities for writing the second example. In some aspects, C++ is easier to use because it partially relieves the burden of explicitly managing memory. But the syntax is more complex because it introduces the possibility of writing classes for OOP. However, it is still possible to write software in C with the OOP approach. Since OOP is a style of programming, it can be used in any language. There are some great examples of OOP in C, such as the [GObject][59] and [Jansson][60] libraries. - -For number crunching, I prefer working in C99 due to its simpler syntax and widespread support. Until recently, C++11 was not as widely supported, and I tended to avoid the rough edges in the previous versions. For more complex software, C++ could be a good choice. - -Do you use C or C++ for data science as well? Share your experiences in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/c-data-science - -作者:[Cristiano L. Fontana][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/cristianofontana -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) -[2]: https://opensource.com/article/18/9/top-3-python-libraries-data-science -[3]: https://opensource.com/article/19/5/learn-python-r-data-science -[4]: https://en.wikipedia.org/wiki/C99 -[5]: https://en.wikipedia.org/wiki/C%2B%2B11 -[6]: https://en.wikipedia.org/wiki/Anscombe%27s_quartet -[7]: https://opensource.com/article/20/2/python-gnu-octave-data-science -[8]: https://en.wikipedia.org/wiki/Command-line_interface -[9]: https://en.wikipedia.org/wiki/Graphical_user_interface -[10]: https://gitlab.com/cristiano.fontana/polyglot_fit -[11]: https://en.wikipedia.org/wiki/Comma-separated_values -[12]: https://en.wikipedia.org/wiki/C_%28programming_language%29 -[13]: https://www.tiobe.com/tiobe-index/ -[14]: https://redmonk.com/sogrady/2019/07/18/language-rankings-6-19/ -[15]: http://pypl.github.io/PYPL.html -[16]: https://octoverse.github.com/ -[17]: https://en.wikipedia.org/wiki/Compiled_language -[18]: https://en.wikipedia.org/wiki/Compiler -[19]: https://en.wikipedia.org/wiki/Machine_code -[20]: https://en.wikipedia.org/wiki/C_standard_library -[21]: https://en.wiktionary.org/wiki/number-crunching -[22]: https://en.wikipedia.org/wiki/Boilerplate_code -[23]: https://clang.llvm.org/ -[24]: https://gcc.gnu.org/ -[25]: https://www.gnu.org/software/gsl/ -[26]: http://www.gnuplot.info/ -[27]: https://en.wikipedia.org/wiki/Berkeley_Software_Distribution -[28]: https://getfedora.org/ -[29]: https://en.wikipedia.org/wiki/Comment_(computer_programming) -[30]: https://en.wikipedia.org/wiki/Include_directive -[31]: https://en.wikipedia.org/wiki/Linker_%28computing%29 -[32]: https://en.wikipedia.org/wiki/Entry_point#C_and_C++ -[33]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_C99.c -[34]: https://en.wikipedia.org/wiki/Linked_list#Singly_linked_list -[35]: http://man7.org/linux/man-pages/man3/queue.3.html -[36]: https://en.wikipedia.org/wiki/Printf_format_string -[37]: http://www.opengroup.org/onlinepubs/009695399/functions/ferror.html -[38]: http://www.opengroup.org/onlinepubs/009695399/functions/feof.html -[39]: http://man7.org/linux/man-pages/man3/getline.3.html -[40]: https://en.wikipedia.org/wiki/POSIX -[41]: https://en.wikipedia.org/wiki/Lexical_analysis#Token -[42]: http://man7.org/linux/man-pages/man3/strtok.3.html -[43]: http://www.opengroup.org/onlinepubs/009695399/functions/strtok.html -[44]: http://www.opengroup.org/onlinepubs/009695399/functions/sscanf.html -[45]: http://www.opengroup.org/onlinepubs/009695399/functions/malloc.html -[46]: http://man7.org/linux/man-pages/man3/malloc.3.html -[47]: https://www.gnu.org/software/gsl/doc/html/lls.html -[48]: https://en.wikipedia.org/wiki/Memory_leak -[49]: http://www.opengroup.org/onlinepubs/009695399/functions/free.html -[50]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html -[51]: http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html -[52]: https://opensource.com/sites/default/files/uploads/fit_c99.png (Plot and fit of the dataset obtained with C99) -[53]: https://en.wikipedia.org/wiki/C%2B%2B -[54]: http://www.cplusplus.com/info/history/ -[55]: https://en.wikipedia.org/wiki/Object-oriented_programming -[56]: https://en.wikipedia.org/wiki/Sequence_container_%28C%2B%2B%29#Vector -[57]: https://en.wikipedia.org/wiki/C%2B%2B_Standard_Library -[58]: https://opensource.com/sites/default/files/uploads/fit_cpp11.png (Plot and fit of the dataset obtained with C++11) -[59]: https://en.wikipedia.org/wiki/GObject -[60]: http://www.digip.org/jansson/ diff --git a/translated/tech/20200224 Using C and C-- for data science.md b/translated/tech/20200224 Using C and C-- for data science.md new file mode 100644 index 0000000000..26dab50b03 --- /dev/null +++ b/translated/tech/20200224 Using C and C-- for data science.md @@ -0,0 +1,525 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using C and C++ for data science) +[#]: via: (https://opensource.com/article/20/2/c-data-science) +[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) + +在数据科学中使用 C 和 C++ +====== + +> 让我们使用 C99 和 C++ 11 完成常见的数据科学任务。 + +![metrics and data shown on a computer screen][1] + +虽然 [Python][2] 和 [R][3] 之类的语言在数据科学中越来越受欢迎,但是 C 和 C++ 对于高效的数据科学来说是一个不错的选择。在本文中,我们将使用 [C99][4] 和 [C++ 11][5] 编写一个程序,该程序使用 [Anscombe 的四重奏][6]数据集,下面将对其进行解释。 + +我在一篇涉及 [Python 和 GNU Octave][7] 的文章中写了我不断学习语言的动机,值得大家回顾。所有程序都应在[命令行][8]上运行,而不是在[图形用户界面(GUI)][9]上运行。完整的示例可在 [polyglot_fit 存储库][10]中找到。 + +### 编程任务 + +你将在本系列中编写的程序: + +* 从 [CSV 文件] [11]中读取数据 +* 用直线插值数据(即 `f(x)=m ⋅ x + q`) +* 将结果绘制到图像文件 + +这是许多数据科学家遇到的普遍情况。示例数据是 [Anscombe 的四重奏] [6]的第一组,如下表所示。这是一组人工构建的数据,当拟合直线时可以提供相同的结果,但是它们的曲线非常不同。数据文件是一个文本文件,其中的制表符用作列分隔符,几行作为标题。该任务将仅使用第一组(即前两列)。 + +[Anscombe 的四重奏][6] + + +### C 语言的方式 + +[C][12] 语言是通用编程语言,是当今使用最广泛的语言之一(依据 [TIOBE 榜单][13]、[RedMonk 编程语言排名][14]、[编程语言流行度榜单][15]和 [GitHub Octoverse 状态][16])。这是一种相当古老的语言(大约诞生在 1973 年),并且用它编写了许多成功的程序(例如 Linux 内核和 Git 仅是其中两个例子)。它也是最接近计算机内部运行的语言之一,因为它直接用于操作内存。它是一种[编译语言] [17];因此,源代码必须由[编译器][18]转换为[机器代码][19]。它的[标准库][20]很小,功能也不多,因此开发了其他库来提供缺少的功能。 + +我最常在[数字运算][21]中使用该语言,主要是因为其性能。我觉得使用起来很繁琐,因为它需要很多[样板代码][22],但是它在各种环境中都得到了很好的支持。C99 标准是最新版本,增加了一些漂亮的功能,并且得到了编译器的良好支持。 + +我将一路介绍 C 和 C++ 编程的必要背景,以便初学者和高级用户都可以继续学习。 + +#### 安装 + +要使用 C99 进行开发,你需要一个编译器。我通常使用 [Clang][23],不过 [GCC][24] 是另一个有效的开源编译器。对于线性拟合,我选择使用 [GNU 科学库] [25]。对于绘图,我找不到任何明智的库,因此该程序依赖于外部程序:[Gnuplot] [26]。该示例还使用动态数据结构来存储数据,该结构在[伯克利软件分发版(BSD)][27]中定义。 + +在 [Fedora][28] 中安装很容易: + +``` +sudo dnf install clang gnuplot gsl gsl-devel +``` + +#### 注释代码 + +在 C99 中,[注释][29]的格式是在行的开头放置 `//`,行的其它部分将被解释器丢弃。另外,`/*` 和 `*/` 之间的任何内容也将被丢弃。 + +``` +// 这是一个注释,会被解释器忽略 +/* 这也被忽略 */ +``` + +#### 必要的库 + +库由两部分组成: + +* [头文件][30],其中包含函数说明 +* 包含函数定义的源文件 + +头文件包含在源文件中,而库文件的源文件则与可执行文件[链接][31]。因此,此示例所需的头文件是: + +``` +// 输入/输出功能 +#include +// 标准库 +#include +// 字符串操作功能 +#include +// BSD 队列 +#include +// GSL 科学功能 +#include +#include +``` + +#### 主函数 + +在 C 语言中,程序必须位于称为主函数 [main()][32]:的特殊函数内: + +``` +int main(void) { +    ... +} +``` + +这与上一教程中介绍的 Python 不同,后者将运行在源文件中找到的所有代码。 + +#### 定义变量 + +在 C 语言中,变量必须在使用前声明,并且必须与类型关联。每当你要使用变量时,都必须决定要在其中存储哪种数据。你也可以指定是否打算将变量用作常量值,这不是必需的,但是编译器可以从此信息中受益。 来自存储库中的 [fitting_C99.c 程序] [33]: + +``` +const char *input_file_name = "anscombe.csv"; +const char *delimiter = "\t"; +const unsigned int skip_header = 3; +const unsigned int column_x = 0; +const unsigned int column_y = 1; +const char *output_file_name = "fit_C99.csv"; +const unsigned int N = 100; +``` + +C 语言中的数组不是动态的,从某种意义上说,数组的长度必须事先确定(即,在编译之前): + +``` +int data_array[1024]; +``` + +由于你通常不知道文件中有多少个数据点,因此请使用[单链接列表][34]。这是一个动态数据结构,可以无限增长。幸运的是,BSD [提供了链表][35]。这是一个示例定义: + +``` +struct data_point { + double x; + double y; + + SLIST_ENTRY(data_point) entries; +}; + +SLIST_HEAD(data_list, data_point) head = SLIST_HEAD_INITIALIZER(head); +SLIST_INIT(&head); +``` + +该示例定义了一个由结构化值组成的 `data_point` 列表,该结构化值同时包含 `x` 值和 `y` 值。语法相当复杂,但是很直观,详细描述它就会太冗长了。 + +#### 打印输出 + +要在终端上打印,可以使用 [printf()][36] 函数,其功能类似于 Octave 的 `printf()` 函数(在第一篇文章中介绍): + +``` +printf("#### Anscombe's first set with C99 ####\n"); +``` + +`printf()` 函数不会在打印字符串的末尾自动添加换行符,因此你必须添加换行符。第一个参数是一个字符串,可以包含传递给函数的其他参数的格式信息,例如: + +``` +printf("Slope: %f\n", slope); +``` + +#### 读取数据 + +现在来到了困难的部分……有一些用 C 语言解析 CSV 文件的库,但是似乎没有一个库足够稳定或流行到可以放入到 Fedora 软件包存储库中。我没有为本教程添加依赖项,而是决定自己编写此部分。同样,讨论这些细节太啰嗦了,所以我只会解释大致的思路。为了简洁起见,将忽略源代码中的某些行,但是你可以在存储库中找到完整的示例。 + +首先,打开输入文件: + +``` +FILE* input_file = fopen(input_file_name, "r"); +``` + +然后逐行读取文件,直到出现错误或文件结束: + +``` +while (!ferror(input_file) && !feof(input_file)) { + size_t buffer_size = 0; + char *buffer = NULL; + + getline(&buffer, &buffer_size, input_file); + + ... +} +``` + +[getline()][39] 函数是 [POSIX.1-2008 标准][40]新增的一个不错的函数。它可以读取文件中的整行,并负责分配必要的内存。然后使用 [strtok()][42] 函数将每一行分成[字元][41]token。遍历字元,选择所需的列: + +``` +char *token = strtok(buffer, delimiter); + +while (token != NULL) +{ + double value; + sscanf(token, "%lf", &value); + + if (column == column_x) { + x = value; + } else if (column == column_y) { + y = value; + } + + column += 1; + token = strtok(NULL, delimiter); +} +``` + +最后,当选择了 `x` 和 `y` 值时,将新数据点插入链表中: + +``` +struct data_point *datum = malloc(sizeof(struct data_point)); +datum->x = x; +datum->y = y; + +SLIST_INSERT_HEAD(&head, datum, entries); +``` + +[malloc()][46] 函数为新数据点动态分配(保留)一些持久性内存。 + +#### 拟合数据 + +GSL 线性拟合函数 [gsl_fit_linear()][47] 期望其输入为简单数组。因此,由于你将不知道要创建的数组的大小,因此必须手动分配它们的内存: + +``` +const size_t entries_number = row - skip_header - 1; + +double *x = malloc(sizeof(double) * entries_number); +double *y = malloc(sizeof(double) * entries_number); +``` + +然后,遍历链接列表以将相关数据保存到数组: + +``` +SLIST_FOREACH(datum, &head, entries) { + const double current_x = datum->x; + const double current_y = datum->y; + + x[i] = current_x; + y[i] = current_y; + + i += 1; +} +``` + +现在你已经完成了链接列表,请清理它。要**总是**释放已手动分配的内存,以防止[内存泄漏][48]。内存泄漏是糟糕的、糟糕的、糟糕的(重要的话说三遍)。每次内存没有释放时,花园侏儒都会找不到自己的头: + +``` +while (!SLIST_EMPTY(&head)) { + struct data_point *datum = SLIST_FIRST(&head); + + SLIST_REMOVE_HEAD(&head, entries); + + free(datum); +} +``` + +终于,终于!你可以拟合你的数据了: + +``` +gsl_fit_linear(x, 1, y, 1, entries_number, + &intercept, &slope, + &cov00, &cov01, &cov11, &chi_squared); +const double r_value = gsl_stats_correlation(x, 1, y, 1, entries_number); + +printf("Slope: %f\n", slope); +printf("Intercept: %f\n", intercept); +printf("Correlation coefficient: %f\n", r_value); +``` + +#### 绘图 + +你必须使用外部程序进行绘图。因此,将拟合数据保存到外部文件: + +``` +const double step_x = ((max_x + 1) - (min_x - 1)) / N; + +for (unsigned int i = 0; i < N; i += 1) { + const double current_x = (min_x - 1) + step_x * i; + const double current_y = intercept + slope * current_x; + + fprintf(output_file, "%f\t%f\n", current_x, current_y); +} +``` + +用于绘制两个文件的 Gnuplot 命令是: + +``` +plot 'fit_C99.csv' using 1:2 with lines title 'Fit', 'anscombe.csv' using 1:2 with points pointtype 7 title 'Data' +``` + +#### 结果 + +在运行程序之前,你必须编译它: + +``` +clang -std=c99 -I/usr/include/ fitting_C99.c -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_C99 +``` + +这个命令告诉编译器使用 C99 标准,读取 `fitting_C99.c` 文件,加载 `gsl` 和 `gslcblas` 库,并将结果保存到 `fitting_C99`。命令行上的结果输出为: + +``` +#### Anscombe's first set with C99 #### +Slope: 0.500091 +Intercept: 3.000091 +Correlation coefficient: 0.816421 +``` + +这是用 Gnuplot 生成的结果图像。 + +![Plot and fit of the dataset obtained with C99][52] + +### The C++11 way + +[C++][53] is a general-purpose programming language that is also among the most popular languages in use today. It was created as a [successor of C][54] (in 1983) with an emphasis on [object-oriented programming][55] (OOP). C++ is commonly regarded as a superset of C, so a C program should be able to be compiled with a C++ compiler. This is not exactly true, as there are some corner cases where they behave differently. In my experience, C++ needs less boilerplate than C, but the syntax is more difficult if you want to develop objects. The C++11 standard is a recent revision that adds some nifty features and is more or less supported by compilers. + +Since C++ is largely compatible with C, I will just highlight the differences between the two. If I do not cover a section in this part, it means that it is the same as in C. + +#### Installation + +The dependencies for the C++ example are the same as the C example. On Fedora, run: + + +``` +`sudo dnf install clang gnuplot gsl gsl-devel` +``` + +#### Necessary libraries + +Libraries work in the same way as in C, but the `include` directives are slightly different: + + +``` +#include <cstdlib> +#include <cstring> +#include <iostream> +#include <fstream> +#include <string> +#include <vector> +#include <algorithm> + +extern "C" { +#include <gsl/gsl_fit.h> +#include <gsl/gsl_statistics_double.h> +} +``` + +Since the GSL libraries are written in C, you must inform the compiler about this peculiarity. + +#### Defining variables + +C++ supports more data types (classes) than C, such as a `string` type that has many more features than its C counterpart. Update the definition of the variables accordingly: + + +``` +`const std::string input_file_name("anscombe.csv");` +``` + +For structured objects like strings, you can define the variable without using the `=` sign. + +#### Printing output + +You can use the `printf()` function, but the `cout` object is more idiomatic. Use the operator `<<` to indicate the string (or objects) that you want to print with `cout`: + + +``` +std::cout << "#### Anscombe's first set with C++11 ####" << std::endl; + +... + +std::cout << "Slope: " << slope << std::endl; +std::cout << "Intercept: " << intercept << std::endl; +std::cout << "Correlation coefficient: " << r_value << std::endl; +``` + +#### Reading data + +The scheme is the same as before. The file is opened and read line-by-line, but with a different syntax: + + +``` +std::ifstream input_file(input_file_name); + +while (input_file.good()) { +    std::string line; + +    getline(input_file, line); + +    ... +} +``` + +The line tokens are extracted with the same function as in the C99 example. Instead of using standard C arrays, use two [vectors][56]. Vectors are an extension of C arrays in the [C++ standard library][57] that allows dynamic management of memory without explicitly calling `malloc()`: + + +``` +std::vector<double> x; +std::vector<double> y; + +// Adding an element to x and y: +x.emplace_back(value); +y.emplace_back(value); +``` + +#### Fitting data + +For fitting in C++, you do not have to loop over the list, as vectors are guaranteed to have contiguous memory. You can directly pass to the fitting function the pointers to the vectors buffers: + + +``` +gsl_fit_linear(x.data(), 1, y.data(), 1, entries_number, +               &intercept, &slope, +               &cov00, &cov01, &cov11, &chi_squared); +const double r_value = gsl_stats_correlation(x.data(), 1, y.data(), 1, entries_number); + +std::cout << "Slope: " << slope << std::endl; +std::cout << "Intercept: " << intercept << std::endl; +std::cout << "Correlation coefficient: " << r_value << std::endl; +``` + +#### Plotting + +Plotting is done with the same approach as before. Write to a file: + + +``` +const double step_x = ((max_x + 1) - (min_x - 1)) / N; + +for (unsigned int i = 0; i < N; i += 1) { +    const double current_x = (min_x - 1) + step_x * i; +    const double current_y = intercept + slope * current_x; + +    output_file << current_x << "\t" << current_y << std::endl; +} + +output_file.close(); +``` + +And then use Gnuplot for the plotting. + +#### Results + +Before running the program, it must be compiled with a similar command: + + +``` +`clang++ -std=c++11 -I/usr/include/ fitting_Cpp11.cpp -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_Cpp11` +``` + +The resulting output on the command line is: + + +``` +#### Anscombe's first set with C++11 #### +Slope: 0.500091 +Intercept: 3.00009 +Correlation coefficient: 0.816421 +``` + +And this is the resulting image generated with Gnuplot. + +![Plot and fit of the dataset obtained with C++11][58] + +### Conclusion + +This article provides examples for a data fitting and plotting task in C99 and C++11. Since C++ is largely compatible with C, this article exploited their similarities for writing the second example. In some aspects, C++ is easier to use because it partially relieves the burden of explicitly managing memory. But the syntax is more complex because it introduces the possibility of writing classes for OOP. However, it is still possible to write software in C with the OOP approach. Since OOP is a style of programming, it can be used in any language. There are some great examples of OOP in C, such as the [GObject][59] and [Jansson][60] libraries. + +For number crunching, I prefer working in C99 due to its simpler syntax and widespread support. Until recently, C++11 was not as widely supported, and I tended to avoid the rough edges in the previous versions. For more complex software, C++ could be a good choice. + +Do you use C or C++ for data science as well? Share your experiences in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/c-data-science + +作者:[Cristiano L. Fontana][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/cristianofontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://opensource.com/article/18/9/top-3-python-libraries-data-science +[3]: https://opensource.com/article/19/5/learn-python-r-data-science +[4]: https://en.wikipedia.org/wiki/C99 +[5]: https://en.wikipedia.org/wiki/C%2B%2B11 +[6]: https://en.wikipedia.org/wiki/Anscombe%27s_quartet +[7]: https://opensource.com/article/20/2/python-gnu-octave-data-science +[8]: https://en.wikipedia.org/wiki/Command-line_interface +[9]: https://en.wikipedia.org/wiki/Graphical_user_interface +[10]: https://gitlab.com/cristiano.fontana/polyglot_fit +[11]: https://en.wikipedia.org/wiki/Comma-separated_values +[12]: https://en.wikipedia.org/wiki/C_%28programming_language%29 +[13]: https://www.tiobe.com/tiobe-index/ +[14]: https://redmonk.com/sogrady/2019/07/18/language-rankings-6-19/ +[15]: http://pypl.github.io/PYPL.html +[16]: https://octoverse.github.com/ +[17]: https://en.wikipedia.org/wiki/Compiled_language +[18]: https://en.wikipedia.org/wiki/Compiler +[19]: https://en.wikipedia.org/wiki/Machine_code +[20]: https://en.wikipedia.org/wiki/C_standard_library +[21]: https://en.wiktionary.org/wiki/number-crunching +[22]: https://en.wikipedia.org/wiki/Boilerplate_code +[23]: https://clang.llvm.org/ +[24]: https://gcc.gnu.org/ +[25]: https://www.gnu.org/software/gsl/ +[26]: http://www.gnuplot.info/ +[27]: https://en.wikipedia.org/wiki/Berkeley_Software_Distribution +[28]: https://getfedora.org/ +[29]: https://en.wikipedia.org/wiki/Comment_(computer_programming) +[30]: https://en.wikipedia.org/wiki/Include_directive +[31]: https://en.wikipedia.org/wiki/Linker_%28computing%29 +[32]: https://en.wikipedia.org/wiki/Entry_point#C_and_C++ +[33]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_C99.c +[34]: https://en.wikipedia.org/wiki/Linked_list#Singly_linked_list +[35]: http://man7.org/linux/man-pages/man3/queue.3.html +[36]: https://en.wikipedia.org/wiki/Printf_format_string +[37]: http://www.opengroup.org/onlinepubs/009695399/functions/ferror.html +[38]: http://www.opengroup.org/onlinepubs/009695399/functions/feof.html +[39]: http://man7.org/linux/man-pages/man3/getline.3.html +[40]: https://en.wikipedia.org/wiki/POSIX +[41]: https://en.wikipedia.org/wiki/Lexical_analysis#Token +[42]: http://man7.org/linux/man-pages/man3/strtok.3.html +[43]: http://www.opengroup.org/onlinepubs/009695399/functions/strtok.html +[44]: http://www.opengroup.org/onlinepubs/009695399/functions/sscanf.html +[45]: http://www.opengroup.org/onlinepubs/009695399/functions/malloc.html +[46]: http://man7.org/linux/man-pages/man3/malloc.3.html +[47]: https://www.gnu.org/software/gsl/doc/html/lls.html +[48]: https://en.wikipedia.org/wiki/Memory_leak +[49]: http://www.opengroup.org/onlinepubs/009695399/functions/free.html +[50]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html +[51]: http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html +[52]: https://opensource.com/sites/default/files/uploads/fit_c99.png (Plot and fit of the dataset obtained with C99) +[53]: https://en.wikipedia.org/wiki/C%2B%2B +[54]: http://www.cplusplus.com/info/history/ +[55]: https://en.wikipedia.org/wiki/Object-oriented_programming +[56]: https://en.wikipedia.org/wiki/Sequence_container_%28C%2B%2B%29#Vector +[57]: https://en.wikipedia.org/wiki/C%2B%2B_Standard_Library +[58]: https://opensource.com/sites/default/files/uploads/fit_cpp11.png (Plot and fit of the dataset obtained with C++11) +[59]: https://en.wikipedia.org/wiki/GObject +[60]: http://www.digip.org/jansson/ From 921a5a9a67e75f9cfb1ef8aba312e581ba28aa57 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 25 Feb 2020 23:49:12 +0800 Subject: [PATCH 084/260] TSL FINAL --- ...200224 Using C and C-- for data science.md | 141 ++++++++---------- 1 file changed, 66 insertions(+), 75 deletions(-) diff --git a/translated/tech/20200224 Using C and C-- for data science.md b/translated/tech/20200224 Using C and C-- for data science.md index 26dab50b03..c2b3ca0a87 100644 --- a/translated/tech/20200224 Using C and C-- for data science.md +++ b/translated/tech/20200224 Using C and C-- for data science.md @@ -14,7 +14,7 @@ ![metrics and data shown on a computer screen][1] -虽然 [Python][2] 和 [R][3] 之类的语言在数据科学中越来越受欢迎,但是 C 和 C++ 对于高效的数据科学来说是一个不错的选择。在本文中,我们将使用 [C99][4] 和 [C++ 11][5] 编写一个程序,该程序使用 [Anscombe 的四重奏][6]数据集,下面将对其进行解释。 +虽然 [Python][2] 和 [R][3] 之类的语言在数据科学中越来越受欢迎,但是 C 和 C++ 对于高效的数据科学来说是一个不错的选择。在本文中,我们将使用 [C99][4] 和 [C++11][5] 编写一个程序,该程序使用 [Anscombe 的四重奏][6]数据集,下面将对其进行解释。 我在一篇涉及 [Python 和 GNU Octave][7] 的文章中写了我不断学习语言的动机,值得大家回顾。所有程序都应在[命令行][8]上运行,而不是在[图形用户界面(GUI)][9]上运行。完整的示例可在 [polyglot_fit 存储库][10]中找到。 @@ -291,145 +291,136 @@ Correlation coefficient: 0.816421 ![Plot and fit of the dataset obtained with C99][52] -### The C++11 way +### C++11 方式 -[C++][53] is a general-purpose programming language that is also among the most popular languages in use today. It was created as a [successor of C][54] (in 1983) with an emphasis on [object-oriented programming][55] (OOP). C++ is commonly regarded as a superset of C, so a C program should be able to be compiled with a C++ compiler. This is not exactly true, as there are some corner cases where they behave differently. In my experience, C++ needs less boilerplate than C, but the syntax is more difficult if you want to develop objects. The C++11 standard is a recent revision that adds some nifty features and is more or less supported by compilers. +[C++][53] 语言是一种通用编程语言,也是当今使用的最受欢迎的语言之一。它是作为 [C 的继承人][54]创建的(诞生于 1983 年),重点是[面向对象程序设计(OOP)][55]。C++ 通常被视为 C 的超集,因此 C 程序应该能够使用 C++ 编译器进行编译。这并非完全正确,因为在某些极端情况下它们的行为有所不同。 根据我的经验,C++ 比 C 需要更少的样板代码,但是如果要进行对象开发,语法会更困难。C++11 标准是最新版本,增加了一些漂亮的功能,并且或多或少得到了编译器的支持。 -Since C++ is largely compatible with C, I will just highlight the differences between the two. If I do not cover a section in this part, it means that it is the same as in C. +由于 C++ 在很大程度上与 C 兼容,因此我将仅强调两者之间的区别。我在本部分中没有涵盖的任何部分,则意味着它与 C 中的相同。 -#### Installation +#### 安装 -The dependencies for the C++ example are the same as the C example. On Fedora, run: +这个 C++ 示例的依赖项与 C 示例相同。 在 Fedora 上,运行: + +``` +sudo dnf install clang gnuplot gsl gsl-devel +``` + +#### 必要的库 + +库的工作方式与 C 语言相同,但是 `include` 指令略有不同: ``` -`sudo dnf install clang gnuplot gsl gsl-devel` -``` - -#### Necessary libraries - -Libraries work in the same way as in C, but the `include` directives are slightly different: - - -``` -#include <cstdlib> -#include <cstring> -#include <iostream> -#include <fstream> -#include <string> -#include <vector> -#include <algorithm> +#include +#include +#include +#include +#include +#include +#include extern "C" { -#include <gsl/gsl_fit.h> -#include <gsl/gsl_statistics_double.h> +#include +#include } ``` -Since the GSL libraries are written in C, you must inform the compiler about this peculiarity. +由于 GSL 库是用 C 编写的,因此你必须将这种特殊性告知编译器。 -#### Defining variables - -C++ supports more data types (classes) than C, such as a `string` type that has many more features than its C counterpart. Update the definition of the variables accordingly: +#### 定义变量 +与 C 语言相比,C++ 支持更多的数据类型(类),例如,与其 C 语言版本相比,`string` 类型具有更多的功能。相应地更新变量的定义: ``` -`const std::string input_file_name("anscombe.csv");` +const std::string input_file_name("anscombe.csv"); ``` -For structured objects like strings, you can define the variable without using the `=` sign. +对于字符串之类的结构化对象,你可以定义变量而无需使用 `=` 符号。 -#### Printing output - -You can use the `printf()` function, but the `cout` object is more idiomatic. Use the operator `<<` to indicate the string (or objects) that you want to print with `cout`: +#### 打印输出 +你可以使用 `printf()` 函数,但是 `cout` 对象更惯用。使用运算符 `<<` 来指示要使用 `cout` 打印的字符串(或对象): ``` -std::cout << "#### Anscombe's first set with C++11 ####" << std::endl; +std::cout << "#### Anscombe's first set with C++11 ####" << std::endl; ... -std::cout << "Slope: " << slope << std::endl; -std::cout << "Intercept: " << intercept << std::endl; -std::cout << "Correlation coefficient: " << r_value << std::endl; +std::cout << "Slope: " << slope << std::endl; +std::cout << "Intercept: " << intercept << std::endl; +std::cout << "Correlation coefficient: " << r_value << std::endl; ``` -#### Reading data - -The scheme is the same as before. The file is opened and read line-by-line, but with a different syntax: +#### 读取数据 +该方案与以前相同。将打开文件并逐行读取文件,但语法不同: ``` std::ifstream input_file(input_file_name); while (input_file.good()) { -    std::string line; + std::string line; -    getline(input_file, line); + getline(input_file, line); -    ... + ... } ``` -The line tokens are extracted with the same function as in the C99 example. Instead of using standard C arrays, use two [vectors][56]. Vectors are an extension of C arrays in the [C++ standard library][57] that allows dynamic management of memory without explicitly calling `malloc()`: - +使用与 C99 示例相同的功能提取行字元。代替使用标准的 C 数组,而是使用两个[向量][56]。向量是 [C++ 标准库][57]中对 C 数组的扩展,它允许动态管理内存而无需显式调用 `malloc()`: ``` -std::vector<double> x; -std::vector<double> y; +std::vector x; +std::vector y; // Adding an element to x and y: x.emplace_back(value); y.emplace_back(value); ``` -#### Fitting data - -For fitting in C++, you do not have to loop over the list, as vectors are guaranteed to have contiguous memory. You can directly pass to the fitting function the pointers to the vectors buffers: +#### 拟合数据 +要在 C++ 中拟合,你不必遍历列表,因为向量可以保证具有连续的内存。你可以将向量缓冲区的指针直接传递给拟合函数: ``` gsl_fit_linear(x.data(), 1, y.data(), 1, entries_number, -               &intercept, &slope, -               &cov00, &cov01, &cov11, &chi_squared); + &intercept, &slope, + &cov00, &cov01, &cov11, &chi_squared); const double r_value = gsl_stats_correlation(x.data(), 1, y.data(), 1, entries_number); -std::cout << "Slope: " << slope << std::endl; -std::cout << "Intercept: " << intercept << std::endl; -std::cout << "Correlation coefficient: " << r_value << std::endl; +std::cout << "Slope: " << slope << std::endl; +std::cout << "Intercept: " << intercept << std::endl; +std::cout << "Correlation coefficient: " << r_value << std::endl; ``` -#### Plotting - -Plotting is done with the same approach as before. Write to a file: +#### 绘图 +使用与以前相同的方法进行绘图。 写入文件: ``` const double step_x = ((max_x + 1) - (min_x - 1)) / N; -for (unsigned int i = 0; i < N; i += 1) { -    const double current_x = (min_x - 1) + step_x * i; -    const double current_y = intercept + slope * current_x; +for (unsigned int i = 0; i < N; i += 1) { + const double current_x = (min_x - 1) + step_x * i; + const double current_y = intercept + slope * current_x; -    output_file << current_x << "\t" << current_y << std::endl; + output_file << current_x << "\t" << current_y << std::endl; } output_file.close(); ``` -And then use Gnuplot for the plotting. +然后使用 Gnuplot 进行绘图。 -#### Results - -Before running the program, it must be compiled with a similar command: +#### 结果 +在运行程序之前,必须使用类似的命令对其进行编译: ``` -`clang++ -std=c++11 -I/usr/include/ fitting_Cpp11.cpp -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_Cpp11` +clang++ -std=c++11 -I/usr/include/ fitting_Cpp11.cpp -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_Cpp11 ``` -The resulting output on the command line is: - +命令行上的结果输出为: ``` #### Anscombe's first set with C++11 #### @@ -438,17 +429,17 @@ Intercept: 3.00009 Correlation coefficient: 0.816421 ``` -And this is the resulting image generated with Gnuplot. +这就是用 Gnuplot 生成的结果图像。 ![Plot and fit of the dataset obtained with C++11][58] -### Conclusion +### 结论 -This article provides examples for a data fitting and plotting task in C99 and C++11. Since C++ is largely compatible with C, this article exploited their similarities for writing the second example. In some aspects, C++ is easier to use because it partially relieves the burden of explicitly managing memory. But the syntax is more complex because it introduces the possibility of writing classes for OOP. However, it is still possible to write software in C with the OOP approach. Since OOP is a style of programming, it can be used in any language. There are some great examples of OOP in C, such as the [GObject][59] and [Jansson][60] libraries. +本文提供了用 C99 和 C++11 编写的数据拟合和绘图任务的示例。由于 C++ 在很大程度上与 C 兼容,因此本文利用了它们的相似性来编写了第二个示例。在某些方面,C++ 更易于使用,因为它部分减轻了显式管理内存的负担。但是其语法更加复杂,因为它引入了为 OOP 编写类的可能性。但是,仍然可以用 C 使用 OOP 方法编写软件。由于 OOP 是一种编程风格,因此可以以任何语言使用。在 C 中有一些很好的 OOP 示例,例如 [GObject][59] 和 [Jansson][60]库。 -For number crunching, I prefer working in C99 due to its simpler syntax and widespread support. Until recently, C++11 was not as widely supported, and I tended to avoid the rough edges in the previous versions. For more complex software, C++ could be a good choice. +对于数字运算,我更喜欢在 C99 中进行,因为它的语法更简单并且得到了广泛的支持。直到最近,C++11 还没有得到广泛的支持,我倾向于避免使用先前版本中的粗糙不足之处。对于更复杂的软件,C++ 可能是一个不错的选择。 -Do you use C or C++ for data science as well? Share your experiences in the comments. +你是否也将 C 或 C++ 用于数据科学? 在评论中分享你的经验。 -------------------------------------------------------------------------------- @@ -456,7 +447,7 @@ via: https://opensource.com/article/20/2/c-data-science 作者:[Cristiano L. Fontana][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 6648fa74b8bbd7493dc8d8c41ffd46bc572d146f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 26 Feb 2020 01:04:52 +0800 Subject: [PATCH 085/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200225=203=20eB?= =?UTF-8?q?ook=20readers=20for=20the=20Linux=20desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200225 3 eBook readers for the Linux desktop.md --- ...5 3 eBook readers for the Linux desktop.md | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 sources/tech/20200225 3 eBook readers for the Linux desktop.md diff --git a/sources/tech/20200225 3 eBook readers for the Linux desktop.md b/sources/tech/20200225 3 eBook readers for the Linux desktop.md new file mode 100644 index 0000000000..1c057a15ed --- /dev/null +++ b/sources/tech/20200225 3 eBook readers for the Linux desktop.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 eBook readers for the Linux desktop) +[#]: via: (https://opensource.com/article/20/2/linux-ebook-readers) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +3 eBook readers for the Linux desktop +====== +Any of these open source eBook applications will make it easy to read +your books on a larger screen. +![Computer browser with books on the screen][1] + +I usually read eBooks on my phone or with my Kobo eReader. I've never been comfortable reading books on larger screens. However, many people regularly read books on their laptops or desktops. If you are one of them (or think you might be), I'd like to introduce you to three eBook readers for the Linux desktop. + +### Bookworm + +[Bookworm][2] is billed as a "simple, focused eBook reader." And it is. Bookworm has a basic set of features, which some people will complain about being _too basic_ or lacking _functionality_ (whatever that word means). Bookworm does one thing and does it well without unnecessary frills. + +The application's interface is very clean and uncluttered. + +![Bookworm e-book application][3] + +You navigate through a book by pressing: + + * The space bar to move down a page + * The Down and Up arrow keys to move down and up a single line + * The Right and Left arrow keys to jump to the next or previous chapter + + + +You can also annotate portions of a book and insert bookmarks to jump back to a page. + +![Annotations in Bookworm][4] + +Bookworm doesn't have many configuration options. You can change the size and spacing of a book's font, enable a two-page reading view or dark mode, and add folders that Bookworm will scan to find new eBooks. + +![Bookworm preferences][5] + +Bookworm supports the most widely used eBook formats: EPUB, PDF, MOBI, and [FB2][6]. You can also use Bookworm to read popular digital comic book formats [CBR][7] and CBZ. I've tested Bookworm with only the first three formats. PDF files are readable, but they load slowly and the formatting can be rather ugly. + +### Foliate + +As far as features go, [Foliate][8] is a step or two above Bookworm. Not only does it have several more features, but it also has more configuration options. You get all of that in a zippy, clean, and uncluttered package. + +![Foliate e-book application][9] + +You can navigate through an eBook in Foliate using the space bar, arrow keys, or PgUp and PgDn keys. There's nothing unique there. + +You can also annotate text, look up and translate words and phrases, and look up the meanings of words. If you have a text-to-speech application installed on your computer, Foliate can use it to read books aloud. + +![Annotating a book in Foliate][10] + +Foliate has a few more customization options than Bookworm. You can change a book's font and its size, the spacing of lines, and the size of a book's margins. You can also increase or decrease the brightness and select one of four built-in themes. + +![Foliate settings][11] + +You can read books in the EPUB, MOBI, AZW, and AZW3 formats using Foliate. In case you're wondering, the latter three are closed formats used with books published for Amazon's Kindle eReader + +### Calibre's eBook viewer + +[eBook viewer][12] is a component of the [Calibre][13] eBook management tool. Like its parent, the eBook viewer feature isn't the prettiest piece of software out there. + +![E-book Viewer application][14] + +Don't let that put you off, though. It's a solid desktop eBook reader. + +You navigate through an eBook in Calibre's e-book viewer using the arrow and PgUp/PgDn keys or by pressing the space bar. You can also look up words in an online dictionary and add bookmarks throughout a book. E-book viewer lacks an annotation function, but its built-in search engine is solid, and you can save books as PDFs (though I'm not sure why you'd want to). + +Configuration options are an area where this eBook viewer shines. It has far more of them than both Bookworm and Foliate combined. You can change everything from fonts to the layout of text to how text is broken up into pages. On top of that, you can customize the keyboard shortcuts for using the application and add your favorite dictionary website or sites to help you look up words in a book you're reading. + +![E-book Viewer preferences][15] + +One useful feature of Calibre's eBook viewer is the ability to apply your own CSS file to your e-books. CSS, in case you're wondering, is a way to format web pages (which is what many e-books are made of). If you're a master with CSS, you can copy and paste your CSS file into the **User stylesheet** tab in eBook viewer's Preferences window. That's the ultimate in customization. + +eBook viewer, according to its developer, "can display all the major e-book formats." If you're wondering what those formats are, [here's a list][16]. I've tested it with just a few of those formats and have had no problems with them. + +### Final thought + +Whether you're looking for a simple eBook reader or one with bells and whistles and whatever else, the three applications in this article are good choices. Any of them can make reading an eBook on a larger screen easier. + +* * * + +_This article is based on an article published on [Open Source Musings][17] and appears here via a [CC BY-SA 4.0][18] license._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/linux-ebook-readers + +作者:[Scott Nesbitt][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/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_program_books_read.jpg?itok=iNMWe8Bu (Computer browser with books on the screen) +[2]: https://babluboy.github.io/bookworm/ +[3]: https://opensource.com/sites/default/files/uploads/bookworm-reading.png (Bookworm e-book application) +[4]: https://opensource.com/sites/default/files/uploads/bookworm-annotations.png (Annotations in Bookworm) +[5]: https://opensource.com/sites/default/files/uploads/bookworm-preferences.png (Bookworm preferences) +[6]: https://en.wikipedia.org/wiki/FictionBook +[7]: https://en.wikipedia.org/wiki/Comic_book_archive +[8]: https://johnfactotum.github.io/foliate/ +[9]: https://opensource.com/sites/default/files/uploads/foliate-reading.png (Foliate e-book application) +[10]: https://opensource.com/sites/default/files/uploads/foliate-annotation_0.png +[11]: https://opensource.com/sites/default/files/uploads/foliate-settings.png (Foliate settings) +[12]: https://calibre-ebook.com/about +[13]: https://opensourcemusings.com/managing-your-ebooks-with-calibre +[14]: https://opensource.com/sites/default/files/uploads/e-book_viewer-reading.png (E-book Viewer application) +[15]: https://opensource.com/sites/default/files/uploads/ebook-viewer-preferences.png (E-book Viewer preferences) +[16]: https://manual.calibre-ebook.com/faq.html#what-formats-does-calibre-support-conversion-to-from +[17]: https://opensourcemusings.com/three-ebook-readers-for-the-linux-desktop +[18]: https://creativecommons.org/licenses/by-sa/4.0/ From 8c860862f68636d1d557e7acedde96de9c94e4f6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 26 Feb 2020 01:05:35 +0800 Subject: [PATCH 086/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200225=207=20ti?= =?UTF-8?q?ps=20for=20writing=20an=20effective=20technical=20resume?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200225 7 tips for writing an effective technical resume.md --- ...r writing an effective technical resume.md | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sources/tech/20200225 7 tips for writing an effective technical resume.md diff --git a/sources/tech/20200225 7 tips for writing an effective technical resume.md b/sources/tech/20200225 7 tips for writing an effective technical resume.md new file mode 100644 index 0000000000..b3a32876b4 --- /dev/null +++ b/sources/tech/20200225 7 tips for writing an effective technical resume.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 tips for writing an effective technical resume) +[#]: via: (https://opensource.com/article/20/2/technical-resume-writing) +[#]: author: (Emily Brand https://opensource.com/users/emily-brand) + +7 tips for writing an effective technical resume +====== +Present yourself in the best light to potential employers by following +these essentials. +![Two hands holding a resume with computer, clock, and desk chair ][1] + +If you're a software engineer or a manager in the technology sector, creating or updating your resume can be a daunting task. What is most important to consider? How should you handle the formatting, the content, and your objective or summary? What work experience is relevant? How can you make sure automated recruitment tools don't filter out your resume? + +As a hiring manager over the last seven years, I have seen a wide range of resumes and CVs; while some have been impressive, many more have been terribly written. + +When writing or updating your resume, here are seven easy rules to follow. + +### 1\. Summary statement + +The short paragraph at the top of your resume should be clean and concise, have a clear purpose, and avoid excessive use of adjectives and adverbs. Words such as "impressive," "extensive," and "excellent" do not improve your hiring chances; instead, they look and feel like overused filler words. An important question to ask yourself regarding your objective is: **Does it tell the hiring manager what kind of job I'm looking for and how I can provide value to them?** If not, either strengthen and streamline it to answer that question or leave it out altogether. + +### 2\. Work experience + +Numbers, numbers, numbers. Hard facts help you convey your point far more than general statements such as "Helped build, manage, deliver many projects that directly contributed to my customers' bottom line." Your wording should include statistics such as "Directly impacted five projects with top banks that accelerated their time to market by 40%," how many lines of code you committed, or how many teams you managed. Data is far more effective than frilly language to showcase your abilities and value. + +If you are less-experienced and have fewer jobs to showcase, do not include irrelevant experience like part-time summer jobs. Instead, add detail about the specifics of your relevant experience and what you learned that would make you a better employee for the organization you are applying for. + +### 3\. Search terms and jargon + +With technology playing such a huge role in the hiring process, it is extremely important to make sure your resume gets flagged for the right positions—but do not oversell yourself on your resume. If you mention agile skills but do not know what kanban is, think twice. If you mention that you are skilled in Java but haven't used it in five years, beware. If there are languages and frameworks you are familiar with but not necessarily current in, create a different category or divide your experience into "proficient in" and "familiar with." + +### 4\. Education + +If you are not a recent college graduate, there is no need to include your GPA or the clubs or fraternities you participated in, unless you plan on using them as talking points to gain trust during an interview. Be sure that anything you have published or patented is included, even if it is not relevant to the job. If you do not have a college degree, add a certification section in place of education. If you were in the military, include your active duty and reserve time. + +### 5\. Certifications + +Do not include expired certifications unless you are trying to re-enter a field you have left, such as if you were a people manager and are now looking to get back into hands-on programming. If you have certifications that are no longer relevant to the field, do not include them since it can be distracting and unappealing. Leverage your LinkedIn profile to add more color to your resume, as most people will read your resume and your LinkedIn profile before they interview you. + +### 6\. Spelling and grammar + +Ask others to proofread your resume. So often, I have seen misspelled words in a resume or mistaken uses of words like their, they're, and there. These are avoidable and fixable errors that will create a negative impression. Ideally, your resume will be in active tense, but if that makes you uncomfortable, write it in past tense—the most important thing is to maintain a consistent tense throughout. Improper spelling and grammar will convey that you either do not really care about the job you are applying for or do not have the level of attention to detail necessary for the job. + +### 7\. Formatting + +Ensuring your resume looks up-to-date and appealing is an easy way to make a good first impression. Ensuring consistent formatting, e.g., similar margins, similar spacing, capitalization, and colors (but keep color palettes to a minimum) is the most mundane part of resume writing, but it's necessary to show that you take pride in your work and value yourself and your future employer. Use tables where appropriate to space information in a visually appealing way. If given the option, upload your resume in .pdf and .docx formats, and Google Docs exports to the .odt format, which can be opened easily in LibreOffice. Here is an easy Google Docs [resume template][2] that I recommend. You can also purchase templates from companies that do attractive designs for a small fee (under $10). + +### Update regularly + +Updating your resume regularly will minimize your stress if you're asked to (or want to) apply for a job, and it will help you create and maintain a more accurate version of yourself. When working on your resume, be forward-thinking and be sure to ask at least three other people to review it for content, spelling, and grammar. Even if you are recruited by or referred to a company, your interviewers may know you only by your resume, so ensure that it creates a positive first impression of you. + +_Do you have additional tips to add?_ + +Emily Dunham shares her technique for leveraging open source contributions to stand out as a great... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/technical-resume-writing + +作者:[Emily Brand][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/emily-brand +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/resume_career_document_general.png?itok=JEaFL2XI (Two hands holding a resume with computer, clock, and desk chair ) +[2]: https://docs.google.com/document/d/1ARVyybC5qQEiCzUOLElwAdPpKOK0Qf88srr682eHdCQ/edit From db2ef93c0a80927b7f1d9b05fe6439f90934cd42 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 26 Feb 2020 01:06:51 +0800 Subject: [PATCH 087/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200225=20Spilli?= =?UTF-8?q?ng=20over:=20How=20working=20openly=20with=20anxiety=20affects?= =?UTF-8?q?=20my=20team?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200225 Spilling over- How working openly with anxiety affects my team.md --- ...ing openly with anxiety affects my team.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20200225 Spilling over- How working openly with anxiety affects my team.md diff --git a/sources/tech/20200225 Spilling over- How working openly with anxiety affects my team.md b/sources/tech/20200225 Spilling over- How working openly with anxiety affects my team.md new file mode 100644 index 0000000000..2a89fd37a5 --- /dev/null +++ b/sources/tech/20200225 Spilling over- How working openly with anxiety affects my team.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Spilling over: How working openly with anxiety affects my team) +[#]: via: (https://opensource.com/open-organization/20/2/working-anxiety-team-performance) +[#]: author: (Sam Knuth https://opensource.com/users/samfw) + +Spilling over: How working openly with anxiety affects my team +====== +The team might interpret my behavior as evidence of exacting standards +or high expectations. But I know my anxiety does impact their +performance. +![Spider web on green background][1] + +_Editor's note: This article is part of a series on working with mental health conditions. It details the author's personal experiences and is not meant to convey professional medical advice or guidance._ + +I was speaking with one of my direct reports recently about a discussion we'd had with the broader team earlier in the week. In that discussion I had expressed some frustration that we weren't as far along on a particular project as I thought we needed to be. + +"I knew you were disappointed," my staff member said, recalling the meeting, "like you wanted us to be doing something that we weren't doing, or that what we were doing wasn't good enough." + +They paused for a moment and then said, "Sam, I get this feeling from you all the time." + +That comment struck me pretty profoundly. To my team member, perhaps the scenario above is a reflection of my exacting standards, my high expectations, or my desire to see continual improvement with the team. Those are all reasonable explanations for my behavior. + +But there's another ingredient my team may not be aware of: my anxiety. + +### It's not just personal + +[Previously I discussed][2] how my anxiety, beginning with a worry that I'm not "doing enough," can fuel my proactive tendencies, leading to higher performance at work. What I hadn't considered is my team can interpret my _personal_ feeling of not doing enough as an indicator that _they_ are not doing enough. + +Living with anxiety and other mental health conditions feels personal. It's not something I've talked about at work. It's not something I generally discuss, and it's something I've always felt I was coping with as a private part of my life. + +Living with anxiety and other mental health conditions feels personal. It's not something I've talked about at work. It's not something I generally discuss, and it's something I've always felt I was coping with as a private part of my life. + +But that discussion with my staff member made me realize that I can't contain my personality so neatly. In truth, my anxiety spills over to my team in ways I hadn't considered. I don't know if anxiety can "rub off" on someone, but when I try to think about it objectively, I imagine someone with anxiety would feel it heightened if they worked for me (perhaps my anxiety would feed theirs), and one without anxiety might feel I have unreasonable or unmeetable expectations. + +As a leader—even in an open organization, where [hierarchy is not the most important factor][3] in determining influence—I'm aware that I am in a position of a certain amount of power. People observe my behavior more closely than I realize; how I treat people has a big impact on them, the broader organization, and ultimately the success of the team. + +I try hard to treat people with respect, [to assume positive intent][4], to give people the room to do their work in the way they see fit. But, nonetheless, do my team members feel the kind of judgment from me that I continually impose on myself? + +### Counting our achievements + +What feels "good" to me (what calms my anxiety) is to focus _not_ on what we _have achieved_, but on what we _have yet to do_; not to _celebrate success_, but to _find areas for improvement_. So, when we hit a big milestone, my gut reaction is to say, "Great, now that we've come this far, what else can we do to have a bigger impact?" Stopping and celebrating the team's accomplishments before moving on to the next challenge feels foriegn to me. It also makes me anxious that we are pausing in our progress. + +This is [what I've called an anxiety-driven performance loop][2]. The sense of accomplishment (and the external acknowledgement) after an achievement fuels a desire to immediately start looking for the next challenge. To some extent, this performance loop keeps me productive—even though it has other consequences, too. + +What I want to _avoid_ is transferring my anxiety to my team members. I don't want them to feel that I am continually saying, "What have you done for me lately?" even though that is how I feel the world is looking at me. That's an aspect of what I've called [an anxiety inaction loop][5]. + +I try hard to treat people with respect, to assume positive intent, to give people the room to do their work in the way they see fit. But, nonetheless, do my team members feel the kind of judgment from me that I continually impose on myself? + +At a fundamental level, I believe work is never done, that there is always another challenge to explore, other ways to have a larger impact. Leaders need to inspire and motivate us to embrace that reality as an exciting opportunity rather than an endless drudge or a source of continual worry. + +As a leader who suffers from anxiety, this is more challenging to do in practice than it is to understand intellectually. + +While this is an area of continual work for me, I've received some good advice on how to shield my colleagues from my own anxiety-driven loops, like: + + * If celebrating success and acknowledging achievement doesn't come naturally for you, build it into the plan from the start. Ensure you have the celebration of accomplishment accounted for from the beginning of a project. This can help reduce the "what have you done for me lately?" impulse that comes from moving quickly to the next challenge without pausing to acknowledge achievements. + * Work with another team member on acknowledgment and celebration efforts. Others might have different ideas on how to do this effectively, and may also enjoy the process. Giving this responsibility to someone else can help ensure it isn't lost. + * Practice compassion, gratitude, and empathy. This may not come naturally and may take some effort. Putting yourself in someone else's shoes, thinking about their perspective, thanking people for what they have done, and understanding their challenges can go a long way in shifting your own perspective. + * If you find yourself judging others, ask yourself, "Is this useful in terms of what I want or need from this situation?" That is, is carrying judgment going to help you accomplish your goal? Most likely, the answer is no. And, in fact, it may have the opposite effect! + + + +The above tips have been helpful for me. But the goal of this series hasn't been to provide solutions but rather to share my experiences and to use writing to explore my own tendencies and the impact they have on myself and others. I believe that acknowledging and sharing our personal challenges can reduce the [stigma][6] associated with mental illness, create the space needed to start exploring solutions, and to create environments that are more positive and invigorating to work in. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/2/working-anxiety-team-performance + +作者:[Sam Knuth][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/samfw +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-web-internet.png?itok=UQ0zMNJ3 (Spider web on green background) +[2]: https://opensource.com/open-organization/20/1/leading-openly-anxiety +[3]: https://opensource.com/open-organization/resources/open-org-definition +[4]: https://opensource.com/article/17/2/what-happens-when-we-just-assume-positive-intent +[5]: https://opensource.com/open-organization/20/2/working-anxiety-inaction-loop +[6]: https://www.bloomberg.com/news/articles/2019-11-13/mental-health-is-still-a-don-t-ask-don-t-tell-subject-at-work From bd4b713df929278cace9bf4f91696d6cd9060d9f Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 26 Feb 2020 08:30:43 +0800 Subject: [PATCH 088/260] translated --- ...217 How to get MongoDB Server on Fedora.md | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 translated/tech/20200217 How to get MongoDB Server on Fedora.md diff --git a/translated/tech/20200217 How to get MongoDB Server on Fedora.md b/translated/tech/20200217 How to get MongoDB Server on Fedora.md new file mode 100644 index 0000000000..c7da999f65 --- /dev/null +++ b/translated/tech/20200217 How to get MongoDB Server on Fedora.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to get MongoDB Server on Fedora) +[#]: via: (https://fedoramagazine.org/how-to-get-mongodb-server-on-fedora/) +[#]: author: (Honza Horak https://fedoramagazine.org/author/hhorak/) + +如何在 Fedora 上获取 MongoDB 服务器 +====== + +![][1] + +Mongo(来自 “humongous”)是一个高性能,开源,无模式的面向文档的数据库,它是最受欢迎的 [NoSQL][2] 数据库之一。它使用 JSON 作为文档格式,并且可以在多个服务器节点之间进行扩展和复制。 + +### 有关许可证更改的故事 + +上游 MongoD 决定更改服务器代码的许可证已经一年多了。先前的许可证是 GNU Affero General Public License v3(AGPLv3)。但是,上游写了一个新许可证,为了使运行 MongoDB 即服务的公司回馈社区。新许可证称为 Server Side Public License(SSPLv1),关于这个及其原理的更多说明,请参见[MongoDB SSPL FAQ][3]。 + +Fedora 一直只包含自由软件。当 SSPL 发布后,Fedora [确定][4]它并不是自由软件许可。许可证更改日期(2018 年 10 月)之前发布的所有 MongoDB 版本都可保留在 Fedora 中,但之后再也不更新软件包会带来安全问题。因此,从 Fedora 30 开始,Fedora 社区决定完全[移除 MongoDB 服务器][5]。 + +### 开发人员还有哪些选择? + +是的,还有替代方案,例如 PostgreSQL 在最新版本中也支持 JSON,它可以在无法再使用 MongoDB 的情况下使用它。使用 JSONB 类型,索引在 PostgreSQL 中可以很好地工作,其性能可与 MongoDB 媲美,甚至不会受到 ACID 的影响。 + +开发人员可能选择 MongoDB 的技术原因并未随许可证而改变,因此许多人仍想使用它。重要的是要意识到,SSPL 许可证仅更改仅针对 MongoDB 服务器。MongoDB 上游还开发了其他项目,例如 MongoDB 工具,C 和 C++ 客户端库以及用于各种动态语言的连接器,这些项目在客户端(要通过网络与服务器通信的应用中)使用。由于这些包的许可证是自由的(主要是 Apache 许可证),因此它们保留在 Fedora 仓库中,因此用户可以将其用于应用开发。 + +唯一的变化实际是服务器包本身,它已从 Fedora 仓库中完全删除。让我们看看 Fedora 用户可以如何获取非自由的包。 + +### 如何从上游安装 MongoDB 服务器 + +当 Fedora 用户想要安装 MongoDB 服务器时,他们需要直接向上游获取 MongoDB。但是,上游不为 Fedora 提供 RPM 包。相反,MongoDB 服务器可以获取源码 tarball,用户需要自己进行编译(这需要一些开发知识),或者 Fedora 用户可以使用一些兼容的包。在兼容的选项中,最好的选择是 RHEL-8 RPM。以下步骤描述了如何安装它们以及如何启动守护进程。 + +#### 1\. 使用上游 RPM 创建仓库(RHEL-8 构建) +``` + +``` + +$ sudo cat > /etc/yum.repos.d/mongodb.repo &lt;&lt;EOF +[mongodb-upstream] +name=MongoDB Upstream Repository +baseurl= +gpgcheck=1 +enabled=1 +gpgkey= +EOF +``` + +``` + +#### 2\. 安装元软件包,来拉取服务器和工具包 +``` + +``` + +$ sudo dnf install mongodb-org +&lt;snipped> +Installed: +  mongodb-org-4.2.3-1.el8.x86_64           mongodb-org-mongos-4.2.3-1.el8.x86_64   +  mongodb-org-server-4.2.3-1.el8.x86_64    mongodb-org-shell-4.2.3-1.el8.x86_64 +  mongodb-org-tools-4.2.3-1.el8.x86_64           + +Complete! +``` + +``` + +#### 3\. 启动 MongoDB 守护进程 +``` + +``` + +$ sudo systemctl status mongod +● mongod.service - MongoDB Database Server +   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) +   Active: active (running) since Sat 2020-02-08 12:33:45 EST; 2s ago +     Docs: +  Process: 15768 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS) +  Process: 15769 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS) +  Process: 15770 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS) +  Process: 15771 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS) + Main PID: 15773 (mongod) +   Memory: 70.4M +      CPU: 611ms +   CGroup: /system.slice/mongod.service +           └─15773 /usr/bin/mongod -f /etc/mongod.conf +``` + +``` + +#### 4\. 通过 mongo shell 连接服务器来验证是否运行 +``` + +``` + +$ mongo +MongoDB shell version v4.2.3 +connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&amp;gssapiServiceName=mongodb +Implicit session: session { "id" : UUID("20b6e61f-c7cc-4e9b-a25e-5e306d60482f") } +MongoDB server version: 4.2.3 +Welcome to the MongoDB shell. +For interactive help, type "help". +For more comprehensive documentation, see +    +\--- + +> _ +``` + +``` + +就是这样了。如你所见,RHEL-8 包完美兼容,只要 Fedora 包还与 RHEL-8 兼容,它就应该会一直兼容。 请注意,在使用时必须遵守 SSPLv1 许可证。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-get-mongodb-server-on-fedora/ + +作者:[Honza Horak][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/hhorak/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/mongodb-816x348.png +[2]: https://en.wikipedia.org/wiki/NoSQL +[3]: https://www.mongodb.com/licensing/server-side-public-license/faq +[4]: https://lists.fedoraproject.org/archives/list/legal@lists.fedoraproject.org/thread/IQIOBOGWJ247JGKX2WD6N27TZNZZNM6C/ +[5]: https://fedoraproject.org/wiki/Changes/MongoDB_Removal From 89554a64694c63b36874d3adc21828d5653340e9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 26 Feb 2020 08:34:08 +0800 Subject: [PATCH 089/260] translating --- .../20200121 Syncthing- Open Source P2P File Syncing Tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md b/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md index aa87c0f873..fe48819ada 100644 --- a/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md +++ b/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 65a5009c831672a177fa24aa25ec54a219f164aa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Feb 2020 08:55:03 +0800 Subject: [PATCH 090/260] Rename sources/tech/20200225 7 tips for writing an effective technical resume.md to sources/talk/20200225 7 tips for writing an effective technical resume.md --- .../20200225 7 tips for writing an effective technical resume.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200225 7 tips for writing an effective technical resume.md (100%) diff --git a/sources/tech/20200225 7 tips for writing an effective technical resume.md b/sources/talk/20200225 7 tips for writing an effective technical resume.md similarity index 100% rename from sources/tech/20200225 7 tips for writing an effective technical resume.md rename to sources/talk/20200225 7 tips for writing an effective technical resume.md From eda5156e9391cce8fd35c2d65fc08af93b3cb78e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Feb 2020 08:56:35 +0800 Subject: [PATCH 091/260] Rename sources/tech/20200225 Spilling over- How working openly with anxiety affects my team.md to sources/talk/20200225 Spilling over- How working openly with anxiety affects my team.md --- ...lling over- How working openly with anxiety affects my team.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200225 Spilling over- How working openly with anxiety affects my team.md (100%) diff --git a/sources/tech/20200225 Spilling over- How working openly with anxiety affects my team.md b/sources/talk/20200225 Spilling over- How working openly with anxiety affects my team.md similarity index 100% rename from sources/tech/20200225 Spilling over- How working openly with anxiety affects my team.md rename to sources/talk/20200225 Spilling over- How working openly with anxiety affects my team.md From bebc2f2957399d3e68e77b0921c5cc1c1c2e84d6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 26 Feb 2020 09:41:59 +0800 Subject: [PATCH 092/260] PRF @HankChow --- ...IP addresses with the Linux dig command.md | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/translated/tech/20200214 Digging up IP addresses with the Linux dig command.md b/translated/tech/20200214 Digging up IP addresses with the Linux dig command.md index 0b95b0a753..95a29d30a8 100644 --- a/translated/tech/20200214 Digging up IP addresses with the Linux dig command.md +++ b/translated/tech/20200214 Digging up IP addresses with the Linux dig command.md @@ -1,22 +1,23 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Digging up IP addresses with the Linux dig command) [#]: via: (https://www.networkworld.com/article/3527430/digging-up-ip-addresses-with-the-dig-command.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -使用 dig 命令查询 IP 地址 +使用 dig 命令挖掘域名解析信息 ====== -命令行工具 `dig` 是用于解析域名和故障排查的一个利器。 -从主要功能上来说,`dig` 和 `nslookup` 之间差异不大,但 `dig` 更像一个加强版的 `nslookup`,可以查询到一些由域名服务器管理的信息,这在排查某些问题的时候非常有用。总的来说,`dig` 是一个既简单易用又功能强大的命令行工具。 +> 命令行工具 `dig` 是用于解析域名和故障排查的一个利器。 + +![](https://img.linux.net.cn/data/attachment/album/202002/26/094028jgvzguau1pdgicpz.jpg) + +从主要功能上来说,`dig` 和 `nslookup` 之间差异不大,但 `dig` 更像一个加强版的 `nslookup`,可以查询到一些由域名服务器管理的信息,这在排查某些问题的时候非常有用。总的来说,`dig` 是一个既简单易用又功能强大的命令行工具。(LCTT 译注:`dig` 和 `nslookup` 行为的主要区别来自于 `dig` 使用是是操作系统本身的解析库,而 `nslookup` 使用的是该程序自带的解析库,这有时候会带来一些行为差异。此外,从表现形式上看,`dig` 返回是结果是以 BIND 配置信息的格式返回的,也带有更多的技术细节。) `dig` 最基本的功能就是查询域名信息,因此它的名称实际上是“域名信息查询工具Domain Information Groper”的缩写。`dig` 向用户返回的内容可以非常详尽,也可以非常简洁,展现内容的多少完全由用户在查询时使用的选项来决定。 -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] - ### 我只需要查询 IP 地址 如果只需要查询某个域名指向的 IP 地址,可以使用 `+short` 选项: @@ -36,7 +37,7 @@ $ dig networkworld.com +short 151.101.194.165 ``` -也正是由于这些网站通过负载均衡实现高可用,在下一次查询的时候,或许会发现这几个 IP 地址的排序有所不同。 +也正是由于这些网站通过负载均衡实现高可用,在下一次查询的时候,或许会发现这几个 IP 地址的排序有所不同。(LCTT 译注:浏览器等应用默认会使用返回的第一个 IP 地址,因此这样实现了一种简单的负载均衡。) ``` $ dig networkworld.com +short @@ -78,8 +79,6 @@ networkworld.com. 300 IN A 151.101.2.165 由于域名服务器有缓存机制,返回的内容可能是之前缓存好的信息。在这种情况下,`dig` 最后显示的查询时间Query time会是 0 毫秒(0 msec): -[][2] - ``` ;; Query time: 0 msec <== ;; SERVER: 127.0.0.53#53(127.0.0.53) @@ -149,7 +148,7 @@ networkworld.com. 300 IN A 151.101.2.165 ### 批量查询域名 -如果你要查询多个域名,可以把这些域名写入到一个文件内,然后使用下面的 `dig` 命令遍历整个文件并给出所有查询结果。 +如果你要查询多个域名,可以把这些域名写入到一个文件内(`domains`),然后使用下面的 `dig` 命令遍历整个文件并给出所有查询结果。 ``` $ dig +noall +answer -f domains @@ -185,7 +184,7 @@ via: https://www.networkworld.com/article/3527430/digging-up-ip-addresses-with-t 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 446cc742c5498046d736ee142db2d7eccfd72665 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 26 Feb 2020 09:42:42 +0800 Subject: [PATCH 093/260] PUB @HankChow https://linux.cn/article-11931-1.html --- ...0214 Digging up IP addresses with the Linux dig command.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200214 Digging up IP addresses with the Linux dig command.md (99%) diff --git a/translated/tech/20200214 Digging up IP addresses with the Linux dig command.md b/published/20200214 Digging up IP addresses with the Linux dig command.md similarity index 99% rename from translated/tech/20200214 Digging up IP addresses with the Linux dig command.md rename to published/20200214 Digging up IP addresses with the Linux dig command.md index 95a29d30a8..01f72b47fd 100644 --- a/translated/tech/20200214 Digging up IP addresses with the Linux dig command.md +++ b/published/20200214 Digging up IP addresses with the Linux dig command.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11931-1.html) [#]: subject: (Digging up IP addresses with the Linux dig command) [#]: via: (https://www.networkworld.com/article/3527430/digging-up-ip-addresses-with-the-dig-command.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 31e7c3d234b0229d3a04d29d2396d3c168d434e6 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 26 Feb 2020 09:44:57 +0800 Subject: [PATCH 094/260] translating by lujun9972 --- .../tech/20200123 6 things you should be doing with Emacs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200123 6 things you should be doing with Emacs.md b/sources/tech/20200123 6 things you should be doing with Emacs.md index b01830cd8e..e23e9b7ccb 100644 --- a/sources/tech/20200123 6 things you should be doing with Emacs.md +++ b/sources/tech/20200123 6 things you should be doing with Emacs.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lujun9972) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8eb343dfa7346eec67903fe3f0b198f3e8884ff3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 26 Feb 2020 10:36:48 +0800 Subject: [PATCH 095/260] PRF @lujun9972 --- ...mail and check your calendar with Emacs.md | 62 ++++++++----------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/translated/tech/20200128 Send email and check your calendar with Emacs.md b/translated/tech/20200128 Send email and check your calendar with Emacs.md index cb5fff0849..04ccdee3f1 100644 --- a/translated/tech/20200128 Send email and check your calendar with Emacs.md +++ b/translated/tech/20200128 Send email and check your calendar with Emacs.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Send email and check your calendar with Emacs) @@ -9,9 +9,10 @@ 使用 Emacs 发送电子邮件和检查日历 ====== -使用 Emacs 文本编辑器管理电子邮件和查看日程安排,这是本系列文章 (2020 年使用开放源码提高生产力的 20 种方法)的第十八篇,。 -![Document sending][1] +> 在 2020 年用开源实现更高生产力的二十种方式的第十八篇文章中,使用 Emacs 文本编辑器管理电子邮件和查看日程安排。 + +![](https://img.linux.net.cn/data/attachment/album/202002/26/103647mnee75vxhcc00z06.jpg) 去年,我给你们带来了 2019 年的 19 天新生产力工具系列。今年,我将采取一种不同的方式:建立一个新的环境,让你使用已用或未用的工具来在新的一年里变得更有效率。 @@ -19,23 +20,20 @@ 两天前,我曾经说过我经常使用 [Vim][2] 和 [Emacs][3],在本系列的 [16][4] 和 [17][5] 天,我讲解了如何在 Vim 中做几乎所有的事情。现在,Emacs 的时间到了! -[Emacs 中的邮件和日历 ][6] +![Emacs 中的邮件和日历][6] -在深入之前,我需要说明两件事。首先,我这里使用默认的 Emacs 配置,而不是我之前[写过 ][8] 的 [Spacemacs][7]。为什么呢?因为这样一来我使用的就是默认快捷键,从而使你可以参考文档,而不必将“本机 Emacs” 转换为 Spacemacs。第二,在本系列文章中我没有对 Org 模式进行任何设置。Org 模式本身几乎可以自成一个完整的系列,它非常强大,但是设置可能非常复杂。 +在深入之前,我需要说明两件事。首先,我这里使用默认的 Emacs 配置,而不是我之前[写过][8]的 [Spacemacs][7]。为什么呢?因为这样一来我使用的就是默认快捷键,从而使你可以参考文档,而不必将“原生的 Emacs” 转换为 Spacemacs。第二,在本系列文章中我没有对 Org 模式进行任何设置。Org 模式本身几乎可以自成一个完整的系列,它非常强大,但是设置可能非常复杂。 #### 配置 Emacs 配置 Emacs 比配置 Vim 稍微复杂一些,但以我之见,从长远来看,这样做是值得的。首先我们创建一个配置文件,并在 Emacs 中打开它: - ``` mkdir ~/.emacs.d emacs ~/.emacs.d/init.el ``` -Next,add some additional package sources to the built-in package manager。Add the following to **init.el**: -接下来,向内置的包管理器添加一些额外的包源。在 **init.el** 中添加以下内容: - +接下来,向内置的包管理器添加一些额外的包源。在 `init.el` 中添加以下内容: ``` (package-initialize) @@ -45,9 +43,7 @@ Next,add some additional package sources to the built-in package manager。Add (package-refresh-contents) ``` -使用 `Ctrl+x Ctrl+s` 保存文件,然后按下 `Ctrl+x Ctrl+c` 退出,再重启 Emacs。Emacs 会在启动时下载所有的插件包列表,之后你就可以使用内置的包管理器安装插件了。 -输入 `Meta+x` 会弹出命令提示符(大多数键盘上 **Meta** 键就是的 **Alt** 键,而在 MacOS 上则是 **Option**)。在命令提示符下输入 **package-list-packages** 就会显示可以安装的包列表。遍历该列表并使用 **i** 键选择以下包: - +使用 `Ctrl+x Ctrl+s` 保存文件,然后按下 `Ctrl+x Ctrl+c` 退出,再重启 Emacs。Emacs 会在启动时下载所有的插件包列表,之后你就可以使用内置的包管理器安装插件了。输入 `Meta+x` 会弹出命令提示符(大多数键盘上 `Meta` 键就是的 `Alt` 键,而在 MacOS 上则是 `Option`)。在命令提示符下输入 `package-list-packages` 就会显示可以安装的包列表。遍历该列表并使用 `i` 键选择以下包: ``` bbdb @@ -57,10 +53,8 @@ calfw-ical notmuch ``` -选好软件包后按 **x** 安装它们。根据你的网络连接情况,这可能需要一段时间。你也许会看到一些编译错误,但是可以忽略它们。 -安装完成后,使用组合键 `Ctrl+x Ctrl+f` 打开 `~/.emacs.d/init.el`,并在 `(package-refresh-packages)` 之后 `(custom-set-variables` 之前添加以下行到文件中。 -`(custom-set-variables` 行由 Emacs 内部维护,你永远不应该修改它之后的任何内容。以**;;**开头的行则是注释。 - +选好软件包后按 `x` 安装它们。根据你的网络连接情况,这可能需要一段时间。你也许会看到一些编译错误,但是可以忽略它们。安装完成后,使用组合键 `Ctrl+x Ctrl+f` 打开 `~/.emacs.d/init.el`,并在 `(package-refresh-packages)` 之后、 `(custom-set-variables` 之前添加以下行到文件中。 +`(custom-set-variables` 行由 Emacs 内部维护,你永远不应该修改它之后的任何内容。以 `;;` 开头的行则是注释。 ``` ;; Set up bbdb @@ -82,41 +76,39 @@ notmuch       user-full-name "My Name") ``` -现在,您已经准备好使用自己的配置启动 Emacs 了!保存 `init.el` 文件 (`Ctrl+x Ctrl+s`),退出 Emacs(`Ctrl+x Ctrl+c`),然后重启之。这次重启要多花些时间。 +现在,你已经准备好使用自己的配置启动 Emacs 了!保存 `init.el` 文件(`Ctrl+x Ctrl+s`),退出 Emacs(`Ctrl+x Ctrl+c`),然后重启之。这次重启要多花些时间。 #### 使用 Notmuch 在 Emacs 中读写电子邮件 -一旦你看到了 Emacs 启动屏幕,你就可以使用 [Notmuch][10] 来阅读电子邮件了。键入 `Meta+x notmuch`,您将看到 notmuch 的 Emacs 接口。 +一旦你看到了 Emacs 启动屏幕,你就可以使用 [Notmuch][10] 来阅读电子邮件了。键入 `Meta+x notmuch`,你将看到 notmuch 的 Emacs 界面。 -![使用 notmuch 阅读邮件 ][11] +![使用 notmuch 阅读邮件][11] -所有加粗的项目都是指向电子邮件视图的链接。你可以通过点击鼠标或者使用 tab 键在它们之间跳转并按 **Return** 或 **Enter** 来访问它们。你可以使用搜索栏来搜索 Notmuch 的数据库,语法与 Notmuch 命令行上的[语法 ][12] 相同。如果你愿意,还可以使用 **[save]** 按钮保存搜索以便未来使用,这些搜索会被添加到屏幕顶部的列表中。如果你进入一个链接就会看到一个相关电子邮件的列表。您可以使用**箭头**键在列表中导航,并在要读取的消息上按 **Enter**。按 **r** 可以回复一条消息,**f** 转发该消息,**q** 退出当前屏幕。 +所有加粗的项目都是指向电子邮件视图的链接。你可以通过点击鼠标或者使用 `tab` 键在它们之间跳转并按回车来访问它们。你可以使用搜索栏来搜索 Notmuch 的数据库,语法与 Notmuch 命令行上的[语法][12] 相同。如果你愿意,还可以使用 `[save]` 按钮保存搜索以便未来使用,这些搜索会被添加到屏幕顶部的列表中。如果你进入一个链接就会看到一个相关电子邮件的列表。你可以使用箭头键在列表中导航,并在要读取的消息上按回车。按 `r` 可以回复一条消息,`f` 转发该消息,`q` 退出当前屏幕。 -You can write a new message by typing **Meta**+**x compose-mail**。Composing,replying,and forwarding all bring up the mail writing interface。When you are done writing your email,press **Ctrl**+**c Ctrl**+**c** to send it。If you decide you don't want to send it,press **Ctrl**+**c Ctrl**+**k** to kill the message compose buffer (window)。 -您可以通过键入 `Meta+x compose-mail` 来编写新消息。撰写、回复和转发都将打开编写邮件的接口。写完邮件后,按 `Ctrl+c Ctrl+c` 发送。如果你决定不发送它,按 `Ctrl+c Ctrl+k` 关闭消息撰写缓冲区(窗口)。 +你可以通过键入 `Meta+x compose-mail` 来编写新消息。撰写、回复和转发都将打开编写邮件的界面。写完邮件后,按 `Ctrl+c Ctrl+c` 发送。如果你决定不发送它,按 `Ctrl+c Ctrl+k` 关闭消息撰写缓冲区(窗口)。 #### 使用 BBDB 在 Emacs 中自动补完电子邮件地址 -[在消息中使用 BBDB 地址 ][13] +![在消息中使用 BBDB 地址][13] 那么通讯录怎么办?这就是 [BBDB][14] 发挥作用的地方。但首先我们需要从 [abook][15] 导入所有地址,方法是打开命令行并运行以下导出命令: - ``` -`abook --convert --outformat vcard --outfile ~/all-my-addresses.vcf --infile ~/.abook/addresses` +abook --convert --outformat vcard --outfile ~/all-my-addresses.vcf --infile ~/.abook/addresses ``` -Emacs 启动后,运行 `Meta+x bbdb-vcard-import-file`。它将提示你输入要导入的文件名,即 `~/all-my-address.vcf`。导入完成后,在编写消息时,可以开始输入名称并使用 **Tab** 搜索和自动完成 “to” 字段的内容。BBDB 还会打开一个联系人缓冲区,以便你确保它是正确的。 +Emacs 启动后,运行 `Meta+x bbdb-vcard-import-file`。它将提示你输入要导入的文件名,即 `~/all-my-address.vcf`。导入完成后,在编写消息时,可以开始输入名称并使用 `Tab` 搜索和自动完成 “to” 字段的内容。BBDB 还会打开一个联系人缓冲区,以便你确保它是正确的。 -既然在 [vdirsyncer][16] 中已经为每个地址都生成了对应的 vcf。文件了,为什么我们还要这样做呢?如果你像我一样,有许多地址,一次处理一个地址是很麻烦的。这样做,你就可以把所有的东西都放在一本书里,做成一个大文件。 +既然在 [vdirsyncer][16] 中已经为每个地址都生成了对应的 .vcf 文件了,为什么我们还要这样做呢?如果你像我一样,有许多地址,一次处理一个地址是很麻烦的。这样做,你就可以把所有的东西都放在 abook 里,做成一个大文件。 #### 使用 calfw 在 Emacs 中浏览日历 ![calfw 日历 ][17] -最后,你可以使用 Emacs 查看日历。在上面的配置中,你安装了 [calfw][18] 包,并添加了一些行来告诉它在哪里可以找到要加载的日历。Calfw 是 Emacs 日历框架的简称,它支持多种日历格式。我使用的是谷歌日历,这也是我放在配置中的链接。日历将在启动时自动加载,您可以通过 `Ctrl+x+b` 命令切换到 **cfw-calendar** 缓冲区来查看日历。 +最后,你可以使用 Emacs 查看日历。在上面的配置中,你安装了 [calfw][18] 包,并添加了一些行来告诉它在哪里可以找到要加载的日历。Calfw 是 “Emacs 日历框架Calendar Framework for Emacs”的简称,它支持多种日历格式。我使用的是谷歌日历,这也是我放在配置中的链接。日历将在启动时自动加载,你可以通过 `Ctrl+x+b` 命令切换到 cfw-calendar 缓冲区来查看日历。 -Calfw 提供日、周、双周和月视图。您可以在日历顶部选择视图,并使用**箭头**键导航日历。不幸的是,calfw 只能查看日历,所以您仍然需要使用 [khal][19] 之类的工具或通过 web 界面来添加、删除和修改事件。 +Calfw 提供日、周、双周和月视图。你可以在日历顶部选择视图,并使用箭头键导航日历。不幸的是,calfw 只能查看日历,所以你仍然需要使用 [khal][19] 之类的工具或通过 web 界面来添加、删除和修改事件。 这就是 Emacs 中的邮件、日历和邮件地址。明天我会展示更多。 @@ -127,7 +119,7 @@ via: https://opensource.com/article/20/1/emacs-mail-calendar 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -136,19 +128,19 @@ via: https://opensource.com/article/20/1/emacs-mail-calendar [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ (Document sending) [2]: https://www.vim.org/ [3]: https://www.gnu.org/software/emacs/ -[4]: https://opensource.com/article/20/1/vim-email-calendar -[5]: https://opensource.com/article/20/1/vim-task-list-reddit-twitter +[4]: https://linux.cn/article-11908-1.html +[5]: https://linux.cn/article-11912-1.html [6]: https://opensource.com/sites/default/files/uploads/productivity_18-1.png (Mail and calendar in Emacs) [7]: https://www.spacemacs.org/ [8]: https://opensource.com/article/19/12/spacemacs [9]: mailto:myemail@mydomain.com [10]: https://notmuchmail.org/ [11]: https://opensource.com/sites/default/files/uploads/productivity_18-2.png (Reading mail with Notmuch) -[12]: https://opensource.com/article/20/1/organize-email-notmuch +[12]: https://linux.cn/article-11807-1.html [13]: https://opensource.com/sites/default/files/uploads/productivity_18-3.png (Composing a message with BBDB addressing) [14]: https://www.jwz.org/bbdb/ -[15]: https://opensource.com/article/20/1/sync-contacts-locally -[16]: https://opensource.com/article/20/1/open-source-calendar +[15]: https://linux.cn/article-11834-1.html +[16]: https://linux.cn/article-11812-1.html [17]: https://opensource.com/sites/default/files/uploads/productivity_18-4.png (calfw calendar) [18]: https://github.com/kiwanami/emacs-calfw [19]: https://khal.readthedocs.io/en/v0.9.2/index.html From dcff6a4c5436cb06be436c8bf6a4a5805565d2aa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 26 Feb 2020 10:40:07 +0800 Subject: [PATCH 096/260] PUB @lujun9972 https://linux.cn/article-11932-1.html --- .../20200128 Send email and check your calendar with Emacs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200128 Send email and check your calendar with Emacs.md (99%) diff --git a/translated/tech/20200128 Send email and check your calendar with Emacs.md b/published/20200128 Send email and check your calendar with Emacs.md similarity index 99% rename from translated/tech/20200128 Send email and check your calendar with Emacs.md rename to published/20200128 Send email and check your calendar with Emacs.md index 04ccdee3f1..2ffdbd22d7 100644 --- a/translated/tech/20200128 Send email and check your calendar with Emacs.md +++ b/published/20200128 Send email and check your calendar with Emacs.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11932-1.html) [#]: subject: (Send email and check your calendar with Emacs) [#]: via: (https://opensource.com/article/20/1/emacs-mail-calendar) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From e325b776eb2fc65600e887d7edd87105888ba91b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 26 Feb 2020 11:49:01 +0800 Subject: [PATCH 097/260] PRF @geekpi --- ...20200219 Don-t like IDEs- Try grepgitvi.md | 53 ++++++++++--------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/translated/tech/20200219 Don-t like IDEs- Try grepgitvi.md b/translated/tech/20200219 Don-t like IDEs- Try grepgitvi.md index a9b0118513..eaeda1abea 100644 --- a/translated/tech/20200219 Don-t like IDEs- Try grepgitvi.md +++ b/translated/tech/20200219 Don-t like IDEs- Try grepgitvi.md @@ -1,26 +1,27 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Don't like IDEs? Try grepgitvi) [#]: via: (https://opensource.com/article/20/2/no-ide-script) [#]: author: (Yedidyah Bar David https://opensource.com/users/didib) -不喜欢 IDE 么?试试看 grepgitvi +不喜欢 IDE?试试看 grepgitvi ====== -一个简单又原始的脚本来用 Vim 打开你选择的文件。 -![Files in a folder][1] -像大多数开发者一样,我整天都在搜索和阅读源码。就我个人而言,我从来没有习惯集成开发环境 (IDE),多年来,我主要使用 **grep** 并复制/粘贴的文件名来打开 Vi(m)。 +> 一个简单又原始的脚本来用 Vim 打开你选择的文件。 + +![](https://img.linux.net.cn/data/attachment/album/202002/26/113942a99a1aujmjpfnfrh.jpg) + +像大多数开发者一样,我整天都在搜索和阅读源码。就我个人而言,我从来没有习惯过集成开发环境 (IDE),多年来,我主要使用 `grep` (找到文件),并复制/粘贴文件名来打开 Vi(m)。 最终,我写了这个脚本,并根据需要缓慢地对其进行了完善。 -它依赖 [Vim][2] 和 [rlwrap][3],并使用 Apache 2.0 许可开源。要使用该脚本,请[将它放到 PATH 中][4],然后在文本目录下运行: - +它依赖 [Vim][2] 和 [rlwrap][3],并使用 Apache 2.0 许可证开源。要使用该脚本,请[将它放到 PATH 中][4],然后在文本目录下运行: ``` -`grepgitvi ` +grepgitvi ``` 它将返回搜索结果的编号列表,并提示你输入结果编号并打开 Vim。退出 Vim 后,它将再次显示列表,直到你输入除结果编号以外的任何内容。你也可以使用向上和向下箭头键选择一个文件。(这对我来说)更容易找到我已经看过的结果。 @@ -42,7 +43,7 @@ # # Requires vim and rlwrap # -# Usage: grepgitvi <grep options> <grep/vim pattern> +# Usage: grepgitvi # TMPD=$(mktemp -d /tmp/grepgitvi.XXXXXX) @@ -51,36 +52,36 @@ COLORED=${TMPD}/colored RLHIST=${TMPD}/readline-history -[ -z "${DIRS}" ] && DIRS=. +[ -z "${DIRS}" ] && DIRS=. cleanup() { -        rm -rf "${TMPD}" + rm -rf "${TMPD}" } trap cleanup 0 -find ${DIRS} -iname .git -prune -o \\! -iname "*.min.css*" -type f -print0 > ${TMPD}/allfiles +find ${DIRS} -iname .git -prune -o \! -iname "*.min.css*" -type f -print0 > ${TMPD}/allfiles -cat ${TMPD}/allfiles | xargs -0 grep --color=always -n -H "$@" > $COLORED -cat ${TMPD}/allfiles | xargs -0 grep -n -H "$@" > $UNCOLORED +cat ${TMPD}/allfiles | xargs -0 grep --color=always -n -H "$@" > $COLORED +cat ${TMPD}/allfiles | xargs -0 grep -n -H "$@" > $UNCOLORED max=`cat $UNCOLORED | wc -l` pat="${@: -1}" inp='' while true; do -        echo "============================ grep results ===============================" -        cat $COLORED | nl -        echo "============================ grep results ===============================" -        prompt="Enter a number between 1 and $max or anything else to quit: " -        inp=$(rlwrap -H $RLHIST bash -c "read -p \"$prompt\" inp; echo \$inp") -        if ! echo "$inp" | grep -q '^[0-9][0-9]*$' || [ "$inp" -gt "$max" ]; then -                break -        fi + echo "============================ grep results ===============================" + cat $COLORED | nl + echo "============================ grep results ===============================" + prompt="Enter a number between 1 and $max or anything else to quit: " + inp=$(rlwrap -H $RLHIST bash -c "read -p \"$prompt\" inp; echo \$inp") + if ! echo "$inp" | grep -q '^[0-9][0-9]*$' || [ "$inp" -gt "$max" ]; then + break + fi -        filename=$(cat $UNCOLORED | awk -F: "NR==$inp"' {print $1}') -        linenum=$(cat $UNCOLORED | awk -F: "NR==$inp"' {print $2-1}') -        vim +:"$linenum" +"norm zz" +/"${pat}" "$filename" + filename=$(cat $UNCOLORED | awk -F: "NR==$inp"' {print $1}') + linenum=$(cat $UNCOLORED | awk -F: "NR==$inp"' {print $2-1}') + vim +:"$linenum" +"norm zz" +/"${pat}" "$filename" done ``` @@ -91,7 +92,7 @@ via: https://opensource.com/article/20/2/no-ide-script 作者:[Yedidyah Bar David][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 0ca2df9cf88212e1a92c1ebe0a38f726c4438934 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 26 Feb 2020 11:50:00 +0800 Subject: [PATCH 098/260] PUB @geekpi https://linux.cn/article-11934-1.html --- .../20200219 Don-t like IDEs- Try grepgitvi.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200219 Don-t like IDEs- Try grepgitvi.md (98%) diff --git a/translated/tech/20200219 Don-t like IDEs- Try grepgitvi.md b/published/20200219 Don-t like IDEs- Try grepgitvi.md similarity index 98% rename from translated/tech/20200219 Don-t like IDEs- Try grepgitvi.md rename to published/20200219 Don-t like IDEs- Try grepgitvi.md index eaeda1abea..7284c57f0f 100644 --- a/translated/tech/20200219 Don-t like IDEs- Try grepgitvi.md +++ b/published/20200219 Don-t like IDEs- Try grepgitvi.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11934-1.html) [#]: subject: (Don't like IDEs? Try grepgitvi) [#]: via: (https://opensource.com/article/20/2/no-ide-script) [#]: author: (Yedidyah Bar David https://opensource.com/users/didib) From 1c13f5f3ce0cdca406eed90801400e6fb522bddb Mon Sep 17 00:00:00 2001 From: way-ww <40491614+way-ww@users.noreply.github.com> Date: Wed, 26 Feb 2020 17:56:04 +0800 Subject: [PATCH 099/260] request to translate --- ...isable SSH Access For A Particular User Or Group In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md b/sources/tech/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md index a717d05ed8..07cb009634 100644 --- a/sources/tech/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md +++ b/sources/tech/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (way-ww) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 33f0cd5d5c64795316a73659b0c7aca1756a9049 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Wed, 26 Feb 2020 17:57:27 +0800 Subject: [PATCH 100/260] translating --- ...20200225 7 tips for writing an effective technical resume.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20200225 7 tips for writing an effective technical resume.md b/sources/talk/20200225 7 tips for writing an effective technical resume.md index b3a32876b4..d91ab742d3 100644 --- a/sources/talk/20200225 7 tips for writing an effective technical resume.md +++ b/sources/talk/20200225 7 tips for writing an effective technical resume.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8a2039b60557c8854baa2cdcc4420f217f8a6a02 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 26 Feb 2020 18:08:46 +0800 Subject: [PATCH 101/260] translate done: 20200123 6 things you should be doing with Emacs.md --- ...6 things you should be doing with Emacs.md | 91 ---------------- ...6 things you should be doing with Emacs.md | 102 ++++++++++++++++++ 2 files changed, 102 insertions(+), 91 deletions(-) delete mode 100644 sources/tech/20200123 6 things you should be doing with Emacs.md create mode 100644 translated/tech/20200123 6 things you should be doing with Emacs.md diff --git a/sources/tech/20200123 6 things you should be doing with Emacs.md b/sources/tech/20200123 6 things you should be doing with Emacs.md deleted file mode 100644 index e23e9b7ccb..0000000000 --- a/sources/tech/20200123 6 things you should be doing with Emacs.md +++ /dev/null @@ -1,91 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (6 things you should be doing with Emacs) -[#]: via: (https://opensource.com/article/20/1/emacs-cheat-sheet) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -6 things you should be doing with Emacs -====== -Here are six things you may not have realized you could do with Emacs. -Then, get our new cheat sheet to get the most out of Emacs. -![Text editor on a browser, in blue][1] - -Imagine using Python's IDLE interface to edit text. You would be able to load files into memory, edit them, and save changes. But every action you perform would be defined by a Python function. Making a word all capitals, for instance, calls **upper()**, opening a file calls **open**, and so on. Everything in your text document is a Python object and can be manipulated accordingly. From the user's perspective, it's the same experience as any text editor. For a Python developer, it's a rich Python environment that can be changed and developed with just a few custom functions in a config file. - -This is what [Emacs][2] does for the 1958 programming language [Lisp][3]. In Emacs, there's no separation between the Lisp engine running the application and the arbitrary text you type into it. To Emacs, everything is Lisp data, so everything can be analyzed and manipulated programmatically. - -That makes for a powerful user interface (UI). But if you're a casual Emacs user, you may only be scratching the surface of what it can do for you. Here are six things you may not have realized you could do with Emacs. - -## Use Tramp mode for cloud editing - -Emacs has been network-transparent for a lot longer than has been trendy, and today it still provides one of the smoothest remote editor experiences available. The [Tramp mode][4] in Emacs (formerly known as RPC mode) stands for "Transparent Remote (file) Access, Multiple Protocol," which spells out exactly what it offers: easy access to remote files you want to edit over most popular network protocols. The most popular and safest protocol for remote editing these days is [OpenSSH][5], so that's the default. - -Tramp is already included in Emacs 22.1 or greater, so to use Tramp, you just open a file in the Tramp syntax. In the **File** menu of Emacs, select **Open File**. When prompted in the mini-buffer at the bottom of the Emacs window, enter the file name using this syntax: - - -``` -`/ssh:user@example.com:/path/to/file` -``` - -If you are required to log in interactively, Tramp prompts you for your password. However, Tramp uses OpenSSH directly, so to avoid interactive prompts, you can also add your hostname, username, and SSH key path to your **~/.ssh/config** file. Like Git, Emacs uses your SSH config first and only stops to ask for more information in the event of an error. - -Tramp is great for editing files that don't exist on your computer, and the user experience is not noticeably any different from editing a local file. The next time you start to SSH into a server just to launch a Vim or Emacs session, try Tramp instead. - -## Calendaring - -If you parse text better than you parse graphical interfaces, you'll be happy to know that you can schedule your day (or life) in plain text with Emacs but still get fancy notifications on your mobile device with open source [Org mode][6] viewers. - -The process takes a little setup to create a convenient way to sync your agenda with your mobile device (I use Git, but you could invoke Bluetooth, KDE Connect, Nextcloud, or your file synchronization tool of choice), and you have to install an Org mode viewer (such as [Orgzly][7]) and a Git client app on your mobile. Once you've got your infrastructure sorted, though, the process is inherently perfectly integrated with your usual (or developing, if you're a new user) Emacs workflow. You can refer to your agenda easily in Emacs, make updates to your schedule, and generally stay on task. Pushing changes to your agenda is reflected on your mobile, so you can stay organized even when Emacs isn't available. - -![][8] - -Intrigued? Read my step-by-step guide about [calendaring with Org mode and Git][9]. - -## Access the terminal - -There are [lots of terminal emulators][10] available. Although the Elisp terminal emulator in Emacs isn't the greatest general-purpose one, it's got two notable advantages. - - 1. **Opens in an Emacs buffer: **I use Emacs' Elisp shell because it's conveniently located in my Emacs window, which I often run in fullscreen. It's a small but significant advantage to have a terminal just a **Ctrl+x+o** (or C-x o in Emacs notation) away, and it's especially nice to be able to glance over at it for status reports when it's running a lengthy job. - 2. **Easy copying and pasting if no system clipboard is available:** Whether I'm too lazy to move my hand from the keys to the mouse, or I don't have mouse functionality because I'm running Emacs in a remote console, having a terminal in Emacs can sometimes mean a quick transfer of data from my Emacs buffer to Bash. - - - -To try the Emacs terminal, type **Alt**+**x** (**M-x** in Emacs notation), then type **shell**, and press **Return**. - -## Use Racket mode - -[Racket][11] is an exciting emerging Lisp dialect with a dynamic programming environment, a GUI toolkit, and a passionate community. The default editor when learning Racket is DrRacket, which has a Definitions panel at the top and an Interactions panel at the bottom. Using this setup, the user writes definitions that affect the Racket runtime. Imagine the old [Logo Turtle][12] program, but with a terminal instead of just a turtle. - -![Racket-mode][13] - -LGPL sample code by PLT - -Emacs, being based on Lisp, makes a great integrated development environment (IDE) for advanced Racket coders. It doesn't ship with [Racket mode][14] (yet), but you can install Racket mode and several other helper extensions using the Emacs package installer. To install it, press **Alt**+**X** (**M-x** in Emacs notation), type **package-install**, and press **Return**. Then enter the package you want to install (**racket-mode**), and press **Return**. - -Enter Racket mode with **M-x racket-mode**. If you're new to Racket but not to Lisp or Emacs, start with the excellent [Quick introduction to Racket with pictures][15]. - -## Scripting - -You might know that Bash scripts are popular for automating and enhancing your Linux or Unix experience. You may have heard that Python does a pretty good job of that, too. But did you know that Lisp scripts can be run in much the same way? There's sometimes confusion about just how useful Lisp really is because many people are introduced to Lisp through Emacs, so there's the latent impression that the only way to run Lisp in the 21st century is to open an Emacs window. Luckily, that's not the case at all, and Emacs is a great IDE for the tools that enable you to run Lisp scripts as general system executables. - -There are two popular modern Lisps, aside from Elisp, that are easy to run as standalone scripts. - - 1. **Racket:** You can run Racket scripts relying on your system's Racket install to provide runtime support, or you can use **raco exe** to produce an executable. The **raco exe** command packages your code together with runtime support files to create an executable. The **raco distribute** command then packages that executable into a distribution that works on other machines. Emacs has many Racket-specific tools, so creating Racket files in Emacs is easy and efficient. - - 2. **GNU Guile:** [GNU Guile][16] (short for "GNU Ubiquitous Intelligent Language for Extensions") is an implementation of the [Scheme][17] programming language that's used for creating applications and games for the desktop, internet, terminal, and more. Writing Scheme is easy, using any one of the many Scheme extensions in Emacs. For example, here's a "Hello world" script in Guile: [code] #!/usr/bin/guile -s -!# - -(display "hello world") -     (newline) [/code] Compile and run it with the **guile** command: [code] $ guile ./hello.scheme -;;; compiling /home/seth/./hello.scheme -;;; compiled [...]/hello.scheme.go -hello world -$ guile ./hello.scheme -hello world -``` -## Run Elisp without Emacs - -Emacs can serve as an Elisp runtime, but you don't have to "open" Emacs in the traditional sense. The **\--script** option allows you to run Elisp scripts using Emacs as the engine but without launching the Emacs GUI (not even its terminal-based one). In this example, the **-Q** option causes Emacs to ignore your **.emacs** file to avoid any delays in executing the Elisp script (if your script relies upon something \ No newline at end of file diff --git a/translated/tech/20200123 6 things you should be doing with Emacs.md b/translated/tech/20200123 6 things you should be doing with Emacs.md new file mode 100644 index 0000000000..62ad555cd3 --- /dev/null +++ b/translated/tech/20200123 6 things you should be doing with Emacs.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 things you should be doing with Emacs) +[#]: via: (https://opensource.com/article/20/1/emacs-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +6 件你应该用 Emacs 做的事 +====== +下面六件事情你可能都没有意识到可以在 Emacs 下完成。此外,使用我们的新备忘单来充分利用 Emacs 的功能吧。 +![浏览器上给蓝色编辑器 ][1] + +想象一下使用 Python 的 IDLE 界面来编辑文本。你可以将文件加载到内存中,编辑它们,并保存更改。但是你执行的每个操作都由 Python 函数定义。例如,调用 **upper()** 来让一个单词全部大写,调用 **open** 打开文件,等等。文本文档中的所有内容都是 Python 对象,可以进行相应的操作。从用户的角度来看,这与其他文本编辑器的体验一致。对于 Python 开发人员来说,这是一个丰富的 Python 环境,只需在配置文件中添加几个自定义函数就可以对其进行更改和开发。 + +这就是 [Emacs][2] 使用 1958 年的编程语言 [Lisp][3] 所做的事情。在 Emacs 中,运行应用程序的 Lisp 引擎与输入文本之间无缝结合。对 Emacs 来说,一切都是 Lisp 数据,因此一切都可以通过编程进行分析和操作。 + +这就形成了一个强大的用户界面 (UI)。但是,如果您是 Emacs 的普通用户,您可能对它的能力知之甚少。下面是你可能没有意识到 Emacs 可以做的六件事。 + +## 使用 Tramp mode 进行云端编辑 + +Emacs 早在网络流行话之前就实现了透明的网络编辑能力了,而且时至今日,它仍然提供了最流畅的远程编辑体验。Emacs 中的 [Tramp mode][4]( 以前称为 RPC mode) 代表着 “Transparent Remote (file) Access,Multiple Protocol( 透明的远程(文件)访问,多协议)”,这详细描述了它提供的功能:通过最流行的网络协议轻松访问您希望编辑的远程文件。目前最流行、最安全的远程编辑协议是 [OpenSSH][5],因此 Tramp 使用它作为默认的协议。 + +在 Emacs 22.1 或更高版本中已经包含了 Tramp,因此要使用 Tramp,只需使用 Tramp 语法打开一个文件。在 Emacs 的 **File** 菜单中,选择 **Open File**。当在 Emacs 窗口底部的小缓冲区中出现提示时,使用以下语法输入文件名: + +``` +`/ssh:user@example.com:/path/to/file` +``` + +如果需要交互式登录,Tramp 会提示输入密码。但是,Tramp 直接使用 OpenSSH,所以为了避免交互提示,你可以将主机名、用户名和 SSH 密钥路径添加到您的 `~/.ssh/config` 文件。与 Git 一样,Emacs 首先使用 SSH 配置,只有在出现错误时才会停下来询问更多信息。 + +Tramp 非常适合编辑计算机上不存在的文件,它的用户体验与编辑本地文件没有明显的区别。下次,当你 SSH 到服务器启动 Vim 或 Emacs 会话时,请尝试使用 Tramp。 + +## 日历 + +如果你喜欢文本多过图形界面,那么你一定会很高兴地知道,可以使用 Emacs 以纯文本的方式安排你的日程(或生活)。而且你依然可以在移动设备上使用开放源码的 [Org mode][6] 查看器来获得华丽的通知。 + +这个过程需要一些配置来创建一个方便的方式来与移动设备同步你的日程(我使用 Git,但你可以调用蓝牙,KDE Connect,Nextcloud,或其他文件同步工具),此外你必须安装一个 Org mode 查看器(如 [Orgzly][7]) 以及移动设备上的 Git 客户程序。但是,一旦你搭建好了这些基础,该流程就会与您常用的(或正在完善的,如果您是新用户 )Emacs 工作流完美地集成在一起。你可以在 Emacs 中方便地查阅日程,更新日程,并专注于任务上。议程上的变化将会反映在移动设备上,因此即使在 Emacs 不可用的时候,你也可以保持条理性。 + +![][8] + +感兴趣了?阅读我的关于[使用 Org mode 和 Git 进行日程安排 ][9] 的逐步指南。 + +## 访问终端 + +有[许多终端模拟器 ][10] 可用。尽管 Emacs 中的 Elisp 终端仿真器不是最强大的通用仿真器,但是它有两个显著的优点。 + +1。**在 Emacs 缓冲区中打开:**我使用 Emacs 的 Elisp shell,因为它在 Emacs 窗口中打开很方便,我经常全屏运行该窗口。这是一个小而重要的优势,只需要输入 `Ctrl+x+o`( 或用 Emacs 符号来表示就是 C-x) 就能使用终端了,而且它还有一个特别好的地方在于当运行漫长的作业时能够一瞥它的状态报告。 +2。**在没有系统剪贴板的情况下复制和粘贴特别方便:** 无论是因为懒惰不愿将手从键盘移动到鼠标,还是因为在远程控制台运行 Emacs 而无法使用鼠标,在 Emacs 中运行终端有时意味着可以快从 Emacs 缓冲区中传输数据到 Bash。 + + + +要尝试 Emacs 终端,输入 `Alt+x (用 Emacs 符号表示就是 M-x)`,然后输入 **shell**,然后按 **Return**。 + +## 使用 Racket mode + +[Racket][11] 是一种激动人心的新兴 Lisp 方言,拥有动态编程环境 、GUI 工具包和热情的社区。学习 Racket 的默认编辑器是 DrRacket,它的顶部是定义面板,底部是交互面板。使用该设置,用户可以编写影响 Racket 运行时的定义。就像旧的 [Logo Turtle][12] 程序,但是有一个终端而不是仅仅一个海龟。 + +![Racket-mode][13] + +由 PLT 提供的 LGPL 示例代码 + +基于 Lisp 的 Emacs 为资深 Racket 编程人员提供了一个很好的集成开发环境 (IDE)。它还没有自带 [Racket mode][14],但你可以使用 Emacs 包安装程序安装 Racket 模式和辅助扩展。 +要安装它,按下 `Alt+X` (用 Emacs 符号表示就是 **M-x**),键入 **package-install**,然后按 **Return**。然后输入要安装的包 (**racet-mode**),按 **Return**。 + +使用 **M-x racket-mode** 进入 Racket mode。如果你是 Racket 新手,但不是对 Lisp 或 Emacs 比较熟悉,可以从优秀[图解 Racket][15] 入手。 + +## 脚本 + +您可能知道,Bash 脚本在自动化和增强 Linux 或 Unix 体验方面很流行。你可能听说过 Python 在这方面也做得很好。但是你知道 Lisp 脚本可以用同样的方式运行吗?有时人们会对 Lisp 到底有多有用感到困惑,因为许多人是通过 Emacs 来了解 Lisp 的,因此有一种潜在的印象,即在 21 世纪运行 Lisp 的惟一方法是在 Emacs 中运行。幸运的是,事实并非如此,Emacs 是一个很好的 IDE,它支持将 Lisp 脚本作为一般的系统可执行文件来运行。 + +除了 Elisp 之外,还有两种流行的现代 lisp 可以很容易地用来作为独立脚本运行。 + +1。**Racket:** 你可以通过在系统上运行 Racket 来提供运行 Racket 脚本所需的运行时支持,或者你可以使用 **raco exe** 产生一个可执行文件。**raco exe** 命令将代码和运行时支持文件一起打包,以创建可执行文件。然后,**raco distribution** 命令将可执行文件打包成可以在其他机器上工作的发行版。Emacs 有许多 Racket 工具,因此在 Emacs 中创建 Racket 文件既简单又有效。 + +2。**GNU Guile:** [GNU Guile][16](“GNU Ubiquitous Intelligent Language for Extensions”--GNU 通用智能语言扩展的缩写)是 [Scheme][17] 编程语言的一个实现,它用于为桌面 、internet、 终端等创建应用程序和游戏。使用 Emacs 中的 Scheme 扩展众多,使用任何一个扩展来编写 Scheme 都很容易。例如,这里有一个用 Guile 编写的 “Hello world” 脚本: +``` +#!/usr/bin/guile - s + +(display "hello world") +     (newline) [/code] Compile and run it with the **guile** command: [code] $ guile ./hello.scheme +;;; compiling /home/seth/./hello.scheme +;;; compiled [...]/hello.scheme.go +hello world +$ guile ./hello.scheme +hello world +``` +## Run Elisp without Emacs +Emacs 可以作为 Elisp 的运行环境,但是你无需按照传统印象中的必须打开 Emacs 来运行 Elisp。`--script` 选项可以让你使用 Emacs 作为引擎来执行 Elisp 脚本而无需运行 Emacs 图形界面(甚至也无需使用终端界面)。下面这个例子中,`-Q` 选项让 Emacs 忽略 `.emacs` 文件从而避免由于执行 Elisp 脚本时产生延迟(若你的脚本依赖于 Emacs 配置中的内容那么请忽略该选项)。 + +``` +emacs -Q --script ~/path/to/script.el +``` +## 下载 Emacs 备忘录 +Emacs 许多重要功能都不是只能通过 Emacs 来实现的; Org mode 是 Emacs 扩展也是一种格式标准,流行的 Lisp 方言大多不依赖于具体的实现,我们甚至可以在没有可见或可交互式 Emacs 实例的情况下编写和运行 Elisp。然后若你对为什么模糊代码和数据之间的界限能够引发创新和效率感到好奇的话,那么 Emacs 是一个很棒的工具。 + +幸运的是,现在是 21 世纪,Emacs 有了带有传统菜单的图形界面以及大量的文档,因此学习曲线不再像以前那样。然而,要最大化 Emacs 对你的好处,你需要学习它的快捷键。由于 Emacs 支持的每个任务都是一个 Elisp 函数,Emacs 中的任何功能都可以对应一个快捷键,因此要描述所有这些快捷键是不可能完成的任务。你只要学习使用频率 10 倍于不常用功能的那些快捷键即可。 + +我们汇聚了最常用的 Emacs 快捷键成为一份 Emacs 备忘录以便你查询。将它挂在屏幕附近或办公室墙上,把它作为鼠标垫也行。让它触手可及经常翻阅一下。每次翻两下可以让你获得十倍的学习效率。而且一旦开始编写自己的函数,你一定不会后悔获取了这个免费的备忘录副本的! + +[这里下载 Emacs 备忘录 ](https://opensource.com/downloads/emacs-cheat-sheet) From 04102e3a82c7dc95a969137f3c7ba8f11f28b988 Mon Sep 17 00:00:00 2001 From: chenmu-kk <53132802+chenmu-kk@users.noreply.github.com> Date: Wed, 26 Feb 2020 18:55:50 +0800 Subject: [PATCH 102/260] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=91=E6=96=87=20?= =?UTF-8?q?(#17524)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update 20190113 Editing Subtitles in Linux.md * Update 20190113 Editing Subtitles in Linux.md * Update 20190113 Editing Subtitles in Linux.md * Update 20190113 Editing Subtitles in Linux.md * Update 20190113 Editing Subtitles in Linux.md * Update 20190113 Editing Subtitles in Linux.md * Rename sources/tech/20190113 Editing Subtitles in Linux.md to translated/translated/tech/20190113 Edeiting Subtitcles in Linux.translated * Rename translated/translated/tech/20190113 Edeiting Subtitcles in Linux.translated to translated/tech/20190113 Edeiting Subtitcles in Linux.translated * Update 20190113 Edeiting Subtitcles in Linux.translated * Rename 20190113 Edeiting Subtitcles in Linux.translated to 20190113 Editing Subtitles in Linux.md Co-authored-by: Xingyu.Wang --- .../20190113 Editing Subtitles in Linux.md | 168 ------------------ .../20190113 Editing Subtitles in Linux.md | 167 +++++++++++++++++ 2 files changed, 167 insertions(+), 168 deletions(-) delete mode 100644 sources/tech/20190113 Editing Subtitles in Linux.md create mode 100644 translated/tech/20190113 Editing Subtitles in Linux.md diff --git a/sources/tech/20190113 Editing Subtitles in Linux.md b/sources/tech/20190113 Editing Subtitles in Linux.md deleted file mode 100644 index 57db2754d4..0000000000 --- a/sources/tech/20190113 Editing Subtitles in Linux.md +++ /dev/null @@ -1,168 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (chenmu-kk ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Editing Subtitles in Linux) -[#]: via: (https://itsfoss.com/editing-subtitles) -[#]: author: (Shirish https://itsfoss.com/author/shirish/) - -Editing Subtitles in Linux -====== - -I have been a world movie and regional movies lover for decades. Subtitles are the essential tool that have enabled me to enjoy the best movies in various languages and from various countries. - -If you enjoy watching movies with subtitles, you might have noticed that sometimes the subtitles are not synced or not correct. - -Did you know that you can edit subtitles and make them better? Let me show you some basic subtitle editing in Linux. - -![Editing subtitles in Linux][1] - -### Extracting subtitles from closed captions data - -Around 2012, 2013 I came to know of a tool called [CCEextractor.][2] As time passed, it has become one of the vital tools for me, especially if I come across a media file which has the subtitle embedded in it. - -CCExtractor analyzes video files and produces independent subtitle files from the closed captions data. - -CCExtractor is a cross-platform, free and open source tool. The tool has matured quite a bit from its formative years and has been part of [GSOC][3] and Google Code-in now and [then.][4] - -The tool, to put it simply, is more or less a set of scripts which work one after another in a serialized order to give you an extracted subtitle. - -You can follow the installation instructions for CCExtractor on [this page][5]. - -After installing when you want to extract subtitles from a media file, do the following: - -``` -ccextractor -``` - -The output of the command will be something like this: - -It basically scans the media file. In this case, it found that the media file is in malyalam and that the media container is an [.mkv][6] container. It extracted the subtitle file with the same name as the video file adding _eng to it. - -CCExtractor is a wonderful tool which can be used to enhance subtitles along with Subtitle Edit which I will share in the next section. - -``` -Interesting Read: There is an interesting synopsis of subtitles at [vicaps][7] which tells and shares why subtitles are important to us. It goes into quite a bit of detail of movie-making as well for those interested in such topics. -``` - -### Editing subtitles with SubtitleEditor Tool - -You probably are aware that most subtitles are in [.srt format][8] . The beautiful thing about this format is and was you could load it in your text editor and do little fixes in it. - -A srt file looks something like this when launched into a simple text-editor: - -The excerpt subtitle I have shared is from a pretty Old German Movie called [The Cabinet of Dr. Caligari (1920)][9] - -Subtitleeditor is a wonderful tool when it comes to editing subtitles. Subtitle Editor is and can be used to manipulate time duration, frame-rate of the subtitle file to be in sync with the media file, duration of breaks in-between and much more. I’ll share some of the basic subtitle editing here. - -![][10] - -First install subtitleeditor the same way you installed ccextractor, using your favorite installation method. In Debian, you can use this command: - -``` -sudo apt install subtitleeditor -``` - -When you have it installed, let’s see some of the common scenarios where you need to edit a subtitle. - -#### Manipulating Frame-rates to sync with Media file - -If you find that the subtitles are not synced with the video, one of the reasons could be the difference between the frame rates of the video file and the subtitle file. - -How do you know the frame rates of these files, then? - -To get the frame rate of a video file, you can use the mediainfo tool. You may need to install it first using your distribution’s package manager. - -Using mediainfo is simple: - -``` -$ mediainfo somefile.mkv | grep Frame - Format settings : CABAC / 4 Ref Frames - Format settings, ReFrames : 4 frames - Frame rate mode : Constant - Frame rate : 25.000 FPS - Bits/(Pixel*Frame) : 0.082 - Frame rate : 46.875 FPS (1024 SPF) -``` - -Now you can see that framerate of the video file is 25.000 FPS. The other Frame-rate we see is for the audio. While I can share why particular fps are used in Video-encoding, Audio-encoding etc. it would be a different subject matter. There is a lot of history associated with it. - -Next is to find out the frame rate of the subtitle file and this is a slightly complicated. - -Usually, most subtitles are in a zipped format. Unzipping the .zip archive along with the subtitle file which ends in something.srt. Along with it, there is usually also a .info file with the same name which sometime may have the frame rate of the subtitle. - -If not, then it usually is a good idea to go some site and download the subtitle from a site which has that frame rate information. For this specific German file, I will be using [Opensubtitle.org][11] - -As you can see in the link, the frame rate of the subtitle is 23.976 FPS. Quite obviously, it won’t play well with my video file with frame rate 25.000 FPS. - -In such cases, you can change the frame rate of the subtitle file using the Subtitle Editor tool: - -Select all the contents from the subtitle file by doing CTRL+A. Go to Timings -> Change Framerate and change frame rates from 23.976 fps to 25.000 fps or whatever it is that is desired. Save the changed file. - -![synchronize frame rates of subtitles in Linux][12] - -#### Changing the Starting position of a subtitle file - -Sometimes the above method may be enough, sometimes though it will not be enough. - -You might find some cases when the start of the subtitle file is different from that in the movie or a media file while the frame rate is the same. - -In such cases, do the following: - -Select all the contents from the subtitle file by doing CTRL+A. Go to Timings -> Select Move Subtitle. - -![Move subtitles using Subtitle Editor on Linux][13] - -Change the new Starting position of the subtitle file. Save the changed file. - -![Move subtitles using Subtitle Editor in Linux][14] - -If you wanna be more accurate, then use [mpv][15] to see the movie or media file and click on the timing, if you click on the timing bar which shows how much the movie or the media file has elapsed, clicking on it will also reveal the microsecond. - -I usually like to be accurate so I try to be as precise as possible. It is very difficult in MPV as human reaction time is imprecise. If I wanna be super accurate then I use something like [Audacity][16] but then that is another ball-game altogether as you can do so much more with it. That may be something to explore in a future blog post as well. - -#### Manipulating Duration - -Sometimes even doing both is not enough and you even have to shrink or add the duration to make it sync with the media file. This is one of the more tedious works as you have to individually fix the duration of each sentence. This can happen especially if you have variable frame rates in the media file (nowadays rare but you still get such files). - -In such a scenario, you may have to edit the duration manually and automation is not possible. The best way is either to fix the video file (not possible without degrading the video quality) or getting video from another source at a higher quality and then [transcode][17] it with the settings you prefer. This again, while a major undertaking I could shed some light on in some future blog post. - -### Conclusion - -What I have shared in above is more or less on improving on existing subtitle files. If you were to start a scratch you need loads of time. I haven’t shared that at all because a movie or any video material of say an hour can easily take anywhere from 4-6 hours or even more depending upon skills of the subtitler, patience, context, jargon, accents, native English speaker, translator etc. all of which makes a difference to the quality of the subtitle. - -I hope you find this interesting and from now onward, you’ll handle your subtitles slightly better. If you have any suggestions to add, please leave a comment below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/editing-subtitles - -作者:[Shirish][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/shirish/ -[b]: https://github.com/lujun9972 -[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/editing-subtitles-in-linux.jpeg?resize=800%2C450&ssl=1 -[2]: https://www.ccextractor.org/ -[3]: https://itsfoss.com/best-open-source-internships/ -[4]: https://www.ccextractor.org/public:codein:google_code-in_2018 -[5]: https://github.com/CCExtractor/ccextractor/wiki/Installation -[6]: https://en.wikipedia.org/wiki/Matroska -[7]: https://www.vicaps.com/blog/history-of-silent-movies-and-subtitles/ -[8]: https://en.wikipedia.org/wiki/SubRip#SubRip_text_file_format -[9]: https://www.imdb.com/title/tt0010323/ -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/subtitleeditor.jpg?ssl=1 -[11]: https://www.opensubtitles.org/en/search/sublanguageid-eng/idmovie-4105 -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/subtitleeditor-frame-rate-sync.jpg?resize=800%2C450&ssl=1 -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/Move-subtitles-Caligiri.jpg?resize=800%2C450&ssl=1 -[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/move-subtitles.jpg?ssl=1 -[15]: https://itsfoss.com/mpv-video-player/ -[16]: https://www.audacityteam.org/ -[17]: https://en.wikipedia.org/wiki/Transcoding -[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/editing-subtitles-in-linux.jpeg?fit=800%2C450&ssl=1 diff --git a/translated/tech/20190113 Editing Subtitles in Linux.md b/translated/tech/20190113 Editing Subtitles in Linux.md new file mode 100644 index 0000000000..84f299fbf4 --- /dev/null +++ b/translated/tech/20190113 Editing Subtitles in Linux.md @@ -0,0 +1,167 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Editing Subtitles in Linux) +[#]: via: (https://itsfoss.com/editing-subtitles) +[#]: author: (Shirish https://itsfoss.com/author/shirish/) + +在 Linux 中编辑字幕 +====== + +我作为一位世界电影和地区电影爱好者已经几十年了。这期间字幕是一个必不可少的工具,它可以使我享受来自不同国家不同语言的优秀电影。 + +如果你喜欢观看带有字幕的电影,你可能会注意到有时字幕并不同步或者说并不正确。 + +你知道你可以自己编写字幕并使得它们更完美吗?让我们向你展示一些 Linux 中的基本字幕编辑吧。 + +![Editing subtitles in Linux][1] + +### 从闭路字幕数据中提取字幕 + +大概在 2012,2013 年我开始了解到有一款叫做 [CCEextractor][2] 的工具。随着时间的推移,它已经成为我必不可少的工具之一 ,尤其是当我偶然发现一份内含有字幕的媒体文件。 + + CCExtractor 负责解析视频文件以及从闭路字幕数据中产生独立的字幕文件。 + + CCExtractor 是一个跨平台、免费且开源的工具。自它形成的那年起该工具已经成熟了不少而如今已成为 [GSOC][3] 和谷歌编码输入的一部分。 + +简单来说,这个工具是一系列或多或少的脚本,这些脚本以一种连续的顺序一个接着一个地给你提供提取到的字幕。 + +你可以按照 [本页][5] 的 CCExtractor 安装指南进行操作。 + +若安装后你想从媒体文件中提取字幕,请按以下步骤操作: + +``` +ccextractor +``` + +该命令将会输出以下内容: + +它会大致浏览媒体文件。在这个例子中,它发现媒体文件是马拉雅拉姆文并且格式是 .mkv[6] 。之后它将字幕文件提取出来,命名为源文件名并添加“_eng”后缀。 + + CCExtractor 是一款用来增强字幕功能和字幕编辑的优秀工具,我将在下一部分对它进行介绍。 + +``` +趣味阅读:在 [vicaps][7] 有一份有趣的字幕简介,会讲解和分享为何字幕对我们如此重要。对于那些对这类话题感兴趣的人来说,这里面也有许多电影制作的细节。 +``` + +### 用 SubtitleEditor 工具编辑字幕 + +你大概意识到大多数的字幕都是 [.srt 格式][8] 的。这种格式的优点在于你可以将它加载到文本编辑器中并对它进行少量的修改。 + +当进入一个简单的文本编辑器时,一个 srt 文件看起来会是这个样子: + +我分享的节选字幕来自于一部非常老的德国电影 [卡里加里博士的小屋 (1920)][9] 。 + + Subtitleeditor 是一款非常棒的字幕编辑软件。字幕编辑器可以用来设置字幕持续时间、与多媒体文件同步的字幕帧率以及字幕间隔时间等等。接下来我将在这分享一些基本的字幕编辑。 + +![][10] + +首先,以安装 ccextractor 工具同样的方式安装 subtitleeditor 工具,使用你自己喜爱的安装方式。在 Debian 中,你可以使用命令: + +``` +sudo apt install subtitleeditor +``` + +当你安装完成后,让我们来看一下在你编辑字幕时一些常见的场景。 + +#### 调整帧率使其媒体文件同步 + +如果你发现字幕与视频不同步,一个原因可能是视频文件的帧率与字幕文件的帧率并不一致。 + +你如何得知这些文件的帧率呢,然后呢? + +为了获取视频文件的帧率,你可以使用 mediainfo 工具。首先你可能需要发行版的包管理器来安装它。 + +使用 mediainfo 非常得简单: + +``` +$ mediainfo somefile.mkv | grep Frame + Format settings : CABAC / 4 Ref Frames + Format settings, ReFrames : 4 frames + Frame rate mode : Constant + Frame rate : 25.000 FPS + Bits/(Pixel*Frame) : 0.082 + Frame rate : 46.875 FPS (1024 SPF) +``` + +现在你可以看到视频文件的帧率是 25.000 FPS 。我们看到的另一个帧率则是音频文件的帧率。虽然我会分享为何在视频解码和音频解码等地方会使用特定的 fps ,但这将会是一个不同的主题,与它相关的历史有很多。 + +下一个问题是解决字幕文件的帧率,这个稍微有点复杂。 + +通常情况下,大多数字幕都是压缩格式的。将.zip归档文件和字幕文件(以 XXX.srt 结尾)一起解压缩。除此之外,通常还会有一个同名的 .info 文件,该文件可能包含字幕的帧率。 + +如果不是,那么通常最好去某个站点并从具有该帧速率信息的站点下载字幕。对于这个特定的德文文件,我将使用 [Opensubtitle.org][11] 。 + +正如你在链接中所看到的,字幕的帧率是 23.976 FPS 。将我的视频文件以 25.000 FPS 的帧率进行播放,显而易见结果并不好。 + +在这种情况下,你可以使用字幕编辑工具来改变字幕文件的帧率: + +按下 CTRL+A 选择字幕文件中的全部内容。点击 Timings -> Change Framerate ,将 23.976 fps 改为 25.000 fps 或者你想要的其他帧率,保存已更改的文件。 + +![synchronize frame rates of subtitles in Linux][12] + +#### 改变字幕文件的起点 + +有时以上的方法就足够解决问题了,但有时候以上方法并不足够解决问题。 + +在帧率相同时,你可能会发现字幕文件的开头与电影或媒体文件中起点并不相同。 + +在这种情况下,请按以下步骤进行操作: + +按下 CTRL+A 键选中字幕文件的全部内容。点击 Timings -> 选择 Move Subtitle 。 + +![Move subtitles using Subtitle Editor on Linux][13] + +设定字幕文件的新起点,保存已更改的文件。 + +![Move subtitles using Subtitle Editor in Linux][14] + +如果你想要时间更精确一点,那么可以使用 [mpv][15] 来查看电影或者媒体文件并点击 timing ,如果你点击了进度条(可以显示电影或者媒体文件的播放进度),它也会显示微秒。 + +通常我喜欢精准无误的操作,因此我会试着尽可能地仔细调节。相较于人类的反应时间来说,MPV中的反应时间很精确。如果我想要极其精确的时间,那么我可以使用像 [Audacity][16] 之类的东西,但是那是另一种工具,你可以在上面做更多的事情。那也将会是我未来博客中将要探讨的东西。 + +#### 调整字幕间隔时间 + +有时,两种方法都采用了还不够,甚至你可能需要缩短或曾加间隔时间以使其与媒体文件同步。这是较为繁琐的工作之一,因为你必须单独确定每个句子的间隔时间。尤其是在媒体文件中帧率可变的情况下(现已很少见,但你仍然会得到此类文件) + +在这种设想下,你可能因为无法实现自动编辑而不得不手动的修改间隔时间。最好的方式是修改视频文件(会降低视频质量)或者换另一个更高质量的片源,用你喜欢的设置对它进行 [转码][17] 。这又是一重大任务,以后我会在我的一些博客文章上阐明。 + +### 结论 + +以上我分享的内容或多或少是对现有字幕文件的改进。如果从头开始,你需要花费大量的时间。我完全没有分享这一点,因为一部电影或一个小时内的任何视频材料都可以轻易地花费 4-6 个小时,甚至更多的时间,这取决于字幕员的技巧、耐心、上下文、行话、口音、是否是以英语为母语的人、翻译等,所有的这些都会对字幕的质量产生影响。 + +我希望自此以后你会觉得这件事很有趣,并将你的字幕处理的更好一点。如果你有其他想要补充的问题,请在下方留言。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/editing-subtitles + +作者:[Shirish][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/shirish/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/editing-subtitles-in-linux.jpeg?resize=800%2C450&ssl=1 +[2]: https://www.ccextractor.org/ +[3]: https://itsfoss.com/best-open-source-internships/ +[4]: https://www.ccextractor.org/public:codein:google_code-in_2018 +[5]: https://github.com/CCExtractor/ccextractor/wiki/Installation +[6]: https://en.wikipedia.org/wiki/Matroska +[7]: https://www.vicaps.com/blog/history-of-silent-movies-and-subtitles/ +[8]: https://en.wikipedia.org/wiki/SubRip#SubRip_text_file_format +[9]: https://www.imdb.com/title/tt0010323/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/subtitleeditor.jpg?ssl=1 +[11]: https://www.opensubtitles.org/en/search/sublanguageid-eng/idmovie-4105 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/subtitleeditor-frame-rate-sync.jpg?resize=800%2C450&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/Move-subtitles-Caligiri.jpg?resize=800%2C450&ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/move-subtitles.jpg?ssl=1 +[15]: https://itsfoss.com/mpv-video-player/ +[16]: https://www.audacityteam.org/ +[17]: https://en.wikipedia.org/wiki/Transcoding +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/editing-subtitles-in-linux.jpeg?fit=800%2C450&ssl=1 From d1d29be14d5dec0ace55b9ceb2402ee5e8660927 Mon Sep 17 00:00:00 2001 From: caiichenr <34886864+caiichenr@users.noreply.github.com> Date: Wed, 26 Feb 2020 20:52:05 +0800 Subject: [PATCH 103/260] translating --- ...3 Building a non-breaking breakpoint for Python debugging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md b/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md index 1c33c05a68..0cafd51c17 100644 --- a/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md +++ b/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (caiichenr) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 182af28cda1901d7142fc41cb189a20e9f8541e4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 26 Feb 2020 21:45:55 +0800 Subject: [PATCH 104/260] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @mengxinayan 请参阅我的校对,这个系列后面希望可以保持一致。 --- ...tructure a multi-file C program- Part 1.md | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/translated/tech/20190729 How to structure a multi-file C program- Part 1.md b/translated/tech/20190729 How to structure a multi-file C program- Part 1.md index 92166f2895..ec4c0dd961 100644 --- a/translated/tech/20190729 How to structure a multi-file C program- Part 1.md +++ b/translated/tech/20190729 How to structure a multi-file C program- Part 1.md @@ -1,43 +1,44 @@ [#]: collector: (lujun9972) [#]: translator: (mengxinayan) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to structure a multi-file C program: Part 1) [#]: via: (https://opensource.com/article/19/7/structure-multi-file-c-part-1) [#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjnyhttps://opensource.com/users/jnyjnyhttps://opensource.com/users/jim-salterhttps://opensource.com/users/cldxsolutions) -如何组织构建多文件 C 语言程序:第一部分 +如何组织构建多文件 C 语言程序(一) ====== -准备好你喜欢的饮料,编辑器和编译器,放一些音乐,然后开始构建一个由多个文件组成的 C 语言程序。 -![Programming keyboard.][1] +> 准备好你喜欢的饮料、编辑器和编译器,放一些音乐,然后开始构建一个由多个文件组成的 C 语言程序。 -大家常说计算机编程的艺术是管理复杂性和命名某些事物中的一部分。此外,我认为“有时需要添加绘图”是很正确的。 +![](https://img.linux.net.cn/data/attachment/album/202002/26/214517o5p7q45l2a8jkx4k.jpg) -在这篇文章里,我会在编写一个小型 C 程序时命名一些东西同时管理一些复杂性。程序的结构基于我所在 “[如何写一个好的 C 语言 main 函数][2]” 文中讨论的。但是,这次做一些不同的事。准备好你喜欢的饮料,编辑器和编译器,放一些音乐,让我们一起编写一个有趣的 C 语言程序。 +大家常说计算机编程的艺术部分是处理复杂性,部分是命名某些事物。此外,我认为“有时需要添加绘图”是在很大程度上是正确的。 -### 好的 Unix 程序中的哲学 +在这篇文章里,我会编写一个小型 C 程序,命名一些东西,同时处理一些复杂性。该程序的结构大致基于我在 《[如何写一个好的 C 语言 main 函数][2]》 文中讨论的。但是,这次做一些不同的事。准备好你喜欢的饮料、编辑器和编译器,放一些音乐,让我们一起编写一个有趣的 C 语言程序。 -首先你要知道这个 C 程序是一个 [Unix][3] 命令行工具。这意味着它运行在那些提供(或者可被移植) Unix C 运行环境的操作系统中。当 Unix 在贝尔实验室被发明后,它从一开始便充满了 [设计哲学][4]。用我的话来说:程序只做一件事,并做好它,然后对文件进行一些操作。虽然只做一件事并做好它是有意义的,但是“对文件进行一些操作”在这儿有一点儿不合适。 +### 优秀 Unix 程序哲学 -“文件” 在 Unix 中的抽象非常强大。一个 Unix 文件是以 end-of-file (EOF) 标志为结尾的字节流。文件中其他结构均由应用添加而非操作系统。操作系统提供了系统调用,使得程序能够对文件执行标准操作:打开,读取,写入,寻找和关闭(还有其他,但那是庞大的额外内容)。对于文件的标准化访问使得不同人用不同语言编写的程序能共用相同的抽象同时一起工作。 +首先,你要知道这个 C 程序是一个 [Unix][3] 命令行工具。这意味着它运行在(或者可被移植到)那些提供 Unix C 运行环境的操作系统中。当贝尔实验室发明 Unix 后,它从一开始便充满了[设计哲学][4]。用我自己的话来说就是:程序只做一件事,并做好它,并且对文件进行一些操作。虽然“只做一件事,并做好它”是有意义的,但是“对文件进行一些操作”的部分似乎有点儿不合适。 -具有共享文件接口可以构建 _可组合的_ 的程序。一个程序的输出可以作为另一个程序的输入。Unix 系操作系统默认为每个运行中程序提供了三个文件:标准输入(`stdin`),标准输出(`stdout`),和标准错误(`stderr`)。其中两个文件是只写的:`stdout` 和 `stderr`。而 `stdin` 是只读的。当我们在常见的 Shell 比如 Bash 中使用文件重定向时,可以看到其效果。 +事实证明,Unix 中抽象的 “文件” 非常强大。一个 Unix 文件是以文件结束符(EOF)标志为结尾的字节流。仅此而已。文件中任何其它结构均由应用程序所施加而非操作系统。操作系统提供了系统调用,使得程序能够对文件执行一套标准的操作:打开、读取、写入、寻址和关闭(还有其他,但说起来那就复杂了)。对于文件的标准化访问使得不同的程序共用相同的抽象,而且可以一同工作,即使它们是不同的人用不同语言编写的程序。 + +具有共享的文件接口使得构建*可组合的*的程序成为可能。一个程序的输出可以作为另一个程序的输入。Unix 家族的操作系统默认在执行程序时提供了三个文件:标准输入(`stdin`)、标准输出(`stdout`)和标准错误(`stderr`)。其中两个文件是只写的:`stdout` 和 `stderr`。而 `stdin` 是只读的。当我们在常见的 Shell 比如 Bash 中使用文件重定向时,可以看到其效果。 ``` -`$ ls | grep foo | sed -e 's/bar/baz/g' > ack` +$ ls | grep foo | sed -e 's/bar/baz/g' > ack ``` -这条指令可以被简要地描述为:`ls` 的结果被写入标准输出,它重定向到 `grep` 的标准输入,`grep` 的标准输出重定向到 `sed`的标准输入,`sed` 的标准输出重定向到当前目录下文件名为 `ack` 的文件中。 +这条指令可以被简要地描述为:`ls` 的结果被写入标准输出,它重定向到 `grep` 的标准输入,`grep` 的标准输出重定向到 `sed` 的标准输入,`sed` 的标准输出重定向到当前目录下文件名为 `ack` 的文件中。 -我们希望我们的程序在系统中灵活而又出色,因此让我们编写一个可以读写文件的程序。 +我们希望我们的程序在这个灵活又出色的生态系统中运作良好,因此让我们编写一个可以读写文件的程序。 -### MeowMeow: 流编码器/解码器概念 +### 喵呜喵呜:流编码器/解码器概念 -当我还是一个孩子在 ltmumblesgts 里学习计算机科学时,有许多编码方案。他们中的有些用于压缩文件,有些用于打包文件,另一些毫无用处因此显得十分愚蠢。列举一个最后一种情况例子:[MooMoo 编码方式][5]。 +当我还是一个露着豁牙的孩子懵懵懂懂地学习计算机科学时,学过很多编码方案。它们中的有些用于压缩文件,有些用于打包文件,另一些毫无用处因此显得十分愚蠢。列举最后这种情况的一个例子:[哞哞编码方案][5]。 -为了给我们程序一个目的,我将在 [2000s][6] 更新该概念并且完成一个名为 “MeowMeow” 的编码方式(因为在互联网上大家都喜欢猫)。这里的基本的想法获取文件并且使用文本 “meow” 对每半个字节进行编码。小写字母代表 0,大写字母代表 1。因为它会将 4 比特替换为 32 比特,因此会扩大文件的大小。这毫无实际意义。但想象一下人们看到经过这样编码后的结果。 +为了让我们的程序有个用途,我为它更新了一个 [21 世纪][6] 的概念,并且实现了一个名为“喵呜喵呜” 的编码方案的概念(毕竟网上大家都喜欢猫)。这里的基本的思路是获取文件并且使用文本 “meow” 对每个半字节(半个字节)进行编码。小写字母代表 0,大写字母代表 1。因为它会将 4 个比特替换为 32 个比特,因此会扩大文件的大小。没错,这毫无意义。但是想象一下人们看到经过这样编码后的惊讶表情。 ``` $ cat /home/your_sibling/.super_secret_journal_of_my_innermost_thoughts @@ -46,47 +47,46 @@ MeOWmeOWmeowMEoW... 这非常棒。 -### 最后完成 +### 最终的实现 完整的源代码可以在 [GitHub][7] 上面找到,但是我会写下我在编写程序时的思考。目的是说明如何组织构建多文件 C 语言程序。 -当我已经确定要编写一个 MeowMeow 编码和解码的程序时,我在 Shell 中执行了以下的命令 : +既然已经确定了要编写一个编码和解码“喵呜喵呜”格式的文件的程序时,我在 Shell 中执行了以下的命令 : ``` $ mkdir meowmeow $ cd meowmeow $ git init -$ touch Makefile     # recipes for compiling the program -$ touch main.c       # handles command-line options -$ touch main.h       # "global" constants and definitions -$ touch mmencode.c   # implements encoding a MeowMeow file -$ touch mmencode.h   # describes the encoding API -$ touch mmdecode.c   # implements decoding a MeowMeow file -$ touch mmdecode.h   # describes the decoding API -$ touch table.h      # defines encoding lookup table values -$ touch .gitignore   # names in this file are ignored by git +$ touch Makefile     # 编译程序的方法 +$ touch main.c       # 处理命令行选项 +$ touch main.h       # “全局”常量和定义 +$ touch mmencode.c   # 实现对喵呜喵呜文件的编码 +$ touch mmencode.h   # 描述编码 API +$ touch mmdecode.c   # 实现对喵呜喵呜文件的解码 +$ touch mmdecode.h   # 描述解码 API +$ touch table.h      # 定义编码查找表 +$ touch .gitignore   # 这个文件中的文件名会被 git 忽略 $ git add . $ git commit -m "initial commit of empty files" ``` -简单的说,我创建了一个空文件并且使用 git 提交。 -In short, I created a directory full of empty files and committed them to git. +简单的说,我创建了一个目录,里面全是空文件,并且提交到 git。 -即使文件中没有内容,你依旧可以从它的文件名推断功能。为了避免万一你无法理解,我在每条 `touch` 命令后面进行了简单描述。 +即使这些文件中没有内容,你依旧可以从它的文件名推断每个文件的用途。为了避免万一你无法理解,我在每条 `touch` 命令后面进行了简单描述。 -通常,一个程序从一个简单 `main.c` 文件开始,只需要两三个函数便可以解决问题。然后程序员便可以向自己的朋友或者老板展示该程序,同时突然显示了文件提示框支持所有新的“功能”和“需求”。“程序俱乐部”的第一条规则便是不谈论“程序俱乐部”。第二条规则是最小化单个文件的功能。 +通常,程序从一个简单 `main.c` 文件开始,只有两三个解决问题的函数。然后程序员轻率地向自己的朋友或者老板展示了该程序,然后为了支持所有新的“功能”和“需求”,文件中的函数数量就迅速爆开了。“程序俱乐部”的第一条规则便是不要谈论“程序俱乐部”,第二条规则是尽量减少单个文件中的函数。 -坦率地说,C 编译器并不关心程序中的所有函数是否都在一个文件中。但是我们并不是为计算机或编译器写程序,我们是为其他人(有时也包括我们)而去写程序的。我知道这有些奇怪,但这就是事实。程序是计算机解决问题所采用的一系列算法,保证人们可以理解它们是非常重要的,即使问题的参数发生了意料之外的变化。当在人们修改程序时,发现一个文件中有 2049 函数时会诅咒你的。 +老实说,C 编译器并不关心程序中的所有函数是否都在一个文件中。但是我们并不是为计算机或编译器写程序,我们是为其他人(有时也包括我们)去写程序的。我知道这可能有些奇怪,但这就是事实。程序体现了计算机解决问题所采用的一组算法,当问题的参数发生了意料之外的变化时,保证人们可以理解它们是非常重要的。当在人们修改程序时,发现一个文件中有 2049 函数时他们会诅咒你的。 -因此,好的程序员会将函数分隔开,将相似的函数分组到不同的文件中。这里我用了三个文件 `main.c`,`mmencode.c` 和 `mmdecode.c`。对于这样的小程序,也许看起来有些过头了。但是小程序很难保证一直小下去,因此计划拓展是一个好主意。 +因此,优秀的程序员会将函数分隔开,将相似的函数分组到不同的文件中。这里我用了三个文件 `main.c`、`mmencode.c` 和 `mmdecode.c`。对于这样小的程序,也许看起来有些过头了。但是小的程序很难保证一直小下去,因此哥忒拓展做好计划是一个“好主意”。 -但是那些 `.h` 文件呢?我会在后面解释一般的术语,简单地说,它们被称为头文件,同时它们可以包含 C 语言类型 和 C 预处理指令。头文件中不应该包含任何函数。你可以认为头文件和对应 `.c` 文件提供了用户编程接口(API)的定义,以便其他 `.c` 文件使用。 +但是那些 `.h` 文件呢?我会在后面解释一般的术语,简单地说,它们被称为头文件,同时它们可以包含 C 语言类型定义和 C 预处理指令。头文件中不应该包含任何函数。你可以认为头文件是提供了应用程序接口(API)的定义的一种 `.c` 文件,可以供其它 `.c` 文件使用。 ### 但是 Makefile 是什么呢? -我知道所有的酷小孩都使用 “Ultra CodeShredder 3000” 集成开发环境来编写下一个轰动一时的应用,同时构建你的项目包括在 Ctrl-Meta-Shift-Alt-Super-B 上进行混搭。但是回到今天,使用 Makefile 文件可以帮助做很多有用的工作在构建 C 程序时。Makefile 是一个包含如何处理文件的方式的文本文件,程序员可以使用其自动地从源代码构建二进制程序(包括其他东西!) +我知道下一个轰动一时的应用都是你们这些好孩子们用 “终极代码粉碎者 3000” 集成开发环境来编写的,而构建项目是用 Ctrl-Meta-Shift-Alt-Super-B 等一系列复杂的按键混搭出来的。但是如今(也就是今天),使用 `Makefile` 文件可以在构建 C 程序时帮助做很多有用的工作。`Makefile` 是一个包含如何处理文件的方式的文本文件,程序员可以使用其自动地从源代码构建二进制程序(以及其它东西!) -以下面这个小程序为例: +以下面这个小东西为例: ``` 00 # Makefile @@ -95,15 +95,15 @@ In short, I created a directory full of empty files and committed them to git. 03    cc -o my_sweet_program main.c ``` -‘#’ 符号后面的文本是注释,例如 00 行 +`#` 符号后面的文本是注释,例如 00 行。 -01 行是一个变量赋值,将 `TARGET` 变量赋值为字符串 `my_sweet_program`。按照惯例我的习惯是,所有 Makefile 变量均使用大写字母并用下划线分隔单词。 +01 行是一个变量赋值,将 `TARGET` 变量赋值为字符串 `my_sweet_program`。按照惯例,也是我的习惯,所有 `Makefile` 变量均使用大写字母并用下划线分隔单词。 -02 行包含要创建的文件名和其依赖的文件。在本例中,构建目标是 `my_sweet_program`,其依赖是 `main.c`。 +02 行包含该步骤recipe要创建的文件名和其依赖的文件。在本例中,构建目标target是 `my_sweet_program`,其依赖是 `main.c`。 -03 行是最后一行使用了一个制表符号(tab)而不是四个空格。这是将执行创建目标的命令。在本例中,我们使用 C 编译器前端 `cc` 以编译链接到 `my_sweet_program`。 +最后的 03 行使用了一个制表符号(`tab`)而不是四个空格。这是将要执行创建目标的命令。在本例中,我们使用 C 编译器C compiler前端 `cc` 以编译链接为 `my_sweet_program`。 -使用 Makefile 是非常简单的。 +使用 `Makefile` 是非常简单的。 ``` $ make @@ -112,59 +112,59 @@ $ ls Makefile  main.c  my_sweet_program ``` -将构建我们 MeowMeow 编码和解码器的 [Makefile][8] 比上面的例子要复杂,但其基本结构是相同的。我将在另一篇文章中将其分解为 Barney 风格。 +构建我们喵呜喵呜编码器/解码器的 [Makefile][8] 比上面的例子要复杂,但其基本结构是相同的。我将在另一篇文章中将其分解为 Barney 风格。 ### 形式伴随着功能 -我的想法是程序从一个文件中读取,转换它,并将转换后的结果存储到另一个文件中。以下是我想象使用程序命令行交互时的情况: +我的想法是程序从一个文件中读取、转换它,并将转换后的结果存储到另一个文件中。以下是我想象使用程序命令行交互时的情况: ``` -        $ meow < clear.txt > clear.meow -        $ unmeow < clear.meow > meow.tx -        $ diff clear.txt meow.tx -        $ +$ meow < clear.txt > clear.meow +$ unmeow < clear.meow > meow.tx +$ diff clear.txt meow.tx +$ ``` -我们需要编写命令行解析和处理输入/输出流的代码。我们需要一个函数对流进行编码并将结果写到另一个流中。最后,我们需要一个函数对流进行解码并将结果写到另一个流中。等一下,我们在讨论如何写一个程序,但是在上面的例子中,我调用了两个指令:`meow` 和 `unmeow`?我知道你可能会认为这会导致越变越复杂。 +我们需要编写代码以进行命令行解析和处理输入/输出流。我们需要一个函数对流进行编码并将结果写到另一个流中。最后,我们需要一个函数对流进行解码并将结果写到另一个流中。等一下,我们在讨论如何写一个程序,但是在上面的例子中,我调用了两个指令:`meow` 和 `unmeow`?我知道你可能会认为这会导致越变越复杂。 ### 次要内容:argv[0] 和 ln 指令 回想一下,C 语言 main 函数的结构如下: ``` -`int main(int argc, char *argv[])` +int main(int argc, char *argv[]) ``` -其中 `argc` 是命令行参数数量,`argv` 是字符指针列表(字符串)。`argv[0]` 是正在运行中的文件的路径。在 Unix 系统中许多互补功能的程序(比如:压缩和解压缩)看起来像两个命令,但事实上,它们在文件系统中是拥有两个名称的一个程序。使用 `ln` 命令通过创建文件系统链接来实现两个名称的功能。 +其中 `argc` 是命令行参数的数量,`argv` 是字符指针(字符串)的列表。`argv[0]` 是包含正在执行的程序的文件路径。在 Unix 系统中许多互补功能的程序(比如:压缩和解压缩)看起来像两个命令,但事实上,它们是在文件系统中拥有两个名称的一个程序。这个技巧是通过使用 `ln` 命令创建文件系统链接来实现两个名称的。 -一个在我笔记本中 `/usr/bin` 的例子如下: +在我笔记本电脑中 `/usr/bin` 的一个例子如下: ``` -   $ ls -li /usr/bin/git* +$ ls -li /usr/bin/git* 3376 -rwxr-xr-x. 113 root root     1.5M Aug 30  2018 /usr/bin/git 3376 -rwxr-xr-x. 113 root root     1.5M Aug 30  2018 /usr/bin/git-receive-pack ... ``` -这里 `git` 和 `git-receive-pack` 是同一个文件但是拥有不同的名字。我们说它们是相同的文件因为它们具有相同的 inode 值(第一列)。inode 是一个 Unix 文件系统的特点,其超越了本文的内容。 +这里 `git` 和 `git-receive-pack` 是同一个文件但是拥有不同的名字。我们说它们是相同的文件因为它们具有相同的 inode 值(第一列)。inode 是 Unix 文件系统的一个特点,对它的介绍超越了本文的内容范畴。 -优秀或懒惰的程序可以通过 Unix 文件系统此特点已达到写更少的代码但是交付双倍的程序。首先,我们编写一个基于其 `argv[0]` 的值而作出相应改变的程序,然后我们确保为该行为的名称创建链接。 +优秀或懒惰的程序可以通过 Unix 文件系统的这个特点达到写更少的代码但是交付双倍的程序。首先,我们编写一个基于其 `argv[0]` 的值而作出相应改变的程序,然后我们确保为导致该行为的名称创建链接。 -在我们的 Makefile 中,`unmeow` 链接通过以下的方式来创建: +在我们的 `Makefile` 中,`unmeow` 链接通过以下的方式来创建: ``` - # Makefile - ... - $(DECODER): $(ENCODER) -         $(LN) -f $< $@ -        ... +# Makefile +... +$(DECODER): $(ENCODER) + $(LN) -f $< $@ + ... ``` -我喜欢在 Makefile 中将所有内容参数化,很少使用 “裸” 字符串。我将所有的定义都放置在 Makefile 文件顶部,以便可以简单地找到并改变它们。当您尝试将程序移植到新的平台上时,需要将 `cc` 改变为 `xcc`时,这会产生很大影响。 +我倾向于在 `Makefile` 中将所有内容参数化,很少使用 “裸” 字符串。我将所有的定义都放置在 `Makefile` 文件顶部,以便可以简单地找到并改变它们。当你尝试将程序移植到新的平台上时,需要将 `cc` 改变为某个 `cc` 时,这会很方便。 -除了两个内置变量 `$@` 和 `$<` 之外,其余的变量显得很简单的。第一个便是创建目标的快捷方式,在本例中,`$(DECODER)` (我记忆它因为它看起来像一个目标)。第二个,`$<` 是规则依赖项,在本例中,它解析为 `$(ENCODER)`。 +除了两个内置变量 `$@` 和 `$<` 之外,该步骤recipe看起来相对简单。第一个便是该步骤的目标的快捷方式,在本例中是 `$(DECODER)`(我能记得这个是因为 `@` 符号看起来像是一个目标)。第二个,`$<` 是规则依赖项,在本例中,它解析为 `$(ENCODER)`。 -事情当然在变得复杂,但是它易于管理。 +事情肯定会变得复杂,但它还在管理之中。 -------------------------------------------------------------------------------- @@ -173,14 +173,14 @@ via: https://opensource.com/article/19/7/structure-multi-file-c-part-1 作者:[Erik O'Shaughnessy][a] 选题:[lujun9972][b] 译者:[萌新阿岩](https://github.com/mengxinayan) -校对:[校对者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/jnyjnyhttps://opensource.com/users/jnyjnyhttps://opensource.com/users/jim-salterhttps://opensource.com/users/cldxsolutions [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A (Programming keyboard.) -[2]: https://opensource.com/article/19/5/how-write-good-c-main-function +[2]: https://linux.cn/article-10949-1.html [3]: https://en.wikipedia.org/wiki/Unix [4]: http://harmful.cat-v.org/cat-v/ [5]: http://www.jabberwocky.com/software/moomooencode.html From da291a3f7f84bf8f067eb8b4413d8a3b86f3f324 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 26 Feb 2020 21:46:29 +0800 Subject: [PATCH 105/260] PUB @mengxinayan https://linux.cn/article-11935-1.html --- ...0190729 How to structure a multi-file C program- Part 1.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190729 How to structure a multi-file C program- Part 1.md (99%) diff --git a/translated/tech/20190729 How to structure a multi-file C program- Part 1.md b/published/20190729 How to structure a multi-file C program- Part 1.md similarity index 99% rename from translated/tech/20190729 How to structure a multi-file C program- Part 1.md rename to published/20190729 How to structure a multi-file C program- Part 1.md index ec4c0dd961..196892cb41 100644 --- a/translated/tech/20190729 How to structure a multi-file C program- Part 1.md +++ b/published/20190729 How to structure a multi-file C program- Part 1.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (mengxinayan) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11935-1.html) [#]: subject: (How to structure a multi-file C program: Part 1) [#]: via: (https://opensource.com/article/19/7/structure-multi-file-c-part-1) [#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjnyhttps://opensource.com/users/jnyjnyhttps://opensource.com/users/jim-salterhttps://opensource.com/users/cldxsolutions) From 28aae540d8f46d7dd60aa47712d4dad91bcf96c0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 27 Feb 2020 00:56:35 +0800 Subject: [PATCH 106/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200226=20How=20?= =?UTF-8?q?we=20decide=20when=20to=20release=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200226 How we decide when to release Fedora.md --- ...26 How we decide when to release Fedora.md | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sources/tech/20200226 How we decide when to release Fedora.md diff --git a/sources/tech/20200226 How we decide when to release Fedora.md b/sources/tech/20200226 How we decide when to release Fedora.md new file mode 100644 index 0000000000..204a917ee4 --- /dev/null +++ b/sources/tech/20200226 How we decide when to release Fedora.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How we decide when to release Fedora) +[#]: via: (https://fedoramagazine.org/how-we-decide-when-to-release-fedora/) +[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) + +How we decide when to release Fedora +====== + +![][1] + +Open source projects can use a variety of different models for deciding when to put out a release. Some projects release on a set schedule. Others decide on what the next release should contain and release whenever that is ready. Some just wake up one day and decide it’s time to release. And other projects go for a rolling release model, avoiding the question entirely. + +For Fedora, we go with a [schedule-based approach][2]. Releasing twice a year means we can give our contributors time to implement large changes while still keeping on the leading edge. Targeting releases for the end of April and the end of October gives everyone predictability: contributors, users, upstreams, and downstreams. + +But it’s not enough to release whatever’s ready on the scheduled date. We want to make sure that we’re releasing _quality_ software. Over the years, the Fedora community has developed a set of processes to help ensure we can meet both our time and and quality targets. + +### Changes process + +Meeting our goals starts months before the release. Contributors propose changes through our [Changes process][3], which ensures that the community has a chance to provide input and be aware of impacts. For changes with a broad impact (called “system-wide changes”), we require a contingency plan that describes how to back out the change if it’s broken or won’t be ready in time. In addition, the change process includes providing steps for testing. This helps make sure we can properly verify the results of a change. + +Change proposals are due 2-3 months before the beta release date. This gives the community time to evaluate the impact of the change and make adjustments necessary. For example, a new compiler release might require other package maintainers to fix bugs exposed by the new compiler or to make changes that take advantage of new capabilities. + +A few weeks before the beta and final releases, we enter a [code freeze][4]. This ensures a stable target for testing. Bugs identified as blockers and non-blocking bugs that are granted a freeze exception are updated in the repo, but everything else must wait. The freeze lasts until the release. + +### Blocker and freeze exception process + +In a project as large as Fedora, it’s impossible to test every possible combination of packages and configurations. So we have a set of test cases that we run to make sure the key features are covered. + +As much as we’d like to ship with zero bugs, if we waited until we reached that state, there’d never be another Fedora release again. Instead, we’ve defined release criteria that define what bugs can [block the release][5]. We have [basic release criteria][6] that apply to all release milestones, and then separate, cumulative criteria for [beta][7] and [final][8] releases. With beta releases, we’re generally a little more forgiving of rough edges. For a final release, it needs to pass all of beta’s criteria, plus some more that help make it a better user experience. + +The week before a scheduled release, we hold a “[go/no go meeting][9]“. During this meeting, the QA team, release engineering team, and the Fedora Engineering Steering Committee (FESCo) decide whether or not we will ship the release. As part of the decision process, we conduct a final review of blocker bugs. If any accepted blockers remain, we push the release back to a later date. + +Some bugs aren’t severe enough to block the release, but we still would like to get them fixed before the release. This is particularly true of bugs that affect the live image experience. In that case, we grant an [exception for updates that fix those bugs][10]. + +### How you can help + +In all my years as a Fedora contributor, I’ve never heard the QA team say “we don’t need any more help.” Contributing to the pre-release testing processes can be a great way to make your first Fedora contribution. + +The Blocker Review meetings happen most Mondays in #fedora-blocker-review on IRC. All members of the Fedora community are welcome to participate in the discussion and voting. One particularly useful contribution is to look at the [proposed blockers][11] and see if you can reproduce them. Knowing if a bug is widespread or not is important to the blocker decision. + +In addition, the QA team conducts test days and test weeks focused on various parts of the distribution: the kernel, GNOME, etc. Test days are announced on [Fedora Magazine][12]. + +There are plenty of other ways to contribute to the QA process. The Fedora wiki has a [list of tasks and how to contact the QA team][13]. The Fedora 32 Beta release is a few weeks away, so now’s a great time to get started! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-we-decide-when-to-release-fedora/ + +作者:[Ben Cotton][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/bcotton/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/releasing-fedora-1-816x345.png +[2]: https://fedoraproject.org/wiki/Fedora_Release_Life_Cycle#Development_Schedule +[3]: https://docs.fedoraproject.org/en-US/program_management/changes_policy/ +[4]: https://fedoraproject.org/wiki/Milestone_freezes +[5]: https://fedoraproject.org/wiki/QA:SOP_blocker_bug_process +[6]: https://fedoraproject.org/wiki/Basic_Release_Criteria +[7]: https://fedoraproject.org/wiki/Fedora_32_Beta_Release_Criteria +[8]: https://fedoraproject.org/wiki/Fedora_32_Final_Release_Criteria +[9]: https://fedoraproject.org/wiki/Go_No_Go_Meeting +[10]: https://fedoraproject.org/wiki/QA:SOP_freeze_exception_bug_process +[11]: https://qa.fedoraproject.org/blockerbugs/ +[12]: https://fedoramagazine.org/tag/test-day/ +[13]: https://fedoraproject.org/wiki/QA/Join From 98472bfae58d508cd4d16ee3d9b9edbc1b546fb6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 27 Feb 2020 08:23:06 +0800 Subject: [PATCH 107/260] translated --- ... to use byobu to multiplex SSH sessions.md | 86 ------------------- ... to use byobu to multiplex SSH sessions.md | 79 +++++++++++++++++ 2 files changed, 79 insertions(+), 86 deletions(-) delete mode 100644 sources/tech/20200212 How to use byobu to multiplex SSH sessions.md create mode 100644 translated/tech/20200212 How to use byobu to multiplex SSH sessions.md diff --git a/sources/tech/20200212 How to use byobu to multiplex SSH sessions.md b/sources/tech/20200212 How to use byobu to multiplex SSH sessions.md deleted file mode 100644 index 7b79a351f8..0000000000 --- a/sources/tech/20200212 How to use byobu to multiplex SSH sessions.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to use byobu to multiplex SSH sessions) -[#]: via: (https://opensource.com/article/20/2/byobu-ssh) -[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) - -How to use byobu to multiplex SSH sessions -====== -Byobu allows you to maintain multiple terminal windows, connect via SSH, -disconnect, reconnect, and share access, all while keeping the session -alive. -![Person drinking a hat drink at the computer][1] - -[Byobu][2] is a text-based window manager and terminal multiplexer. It's similar to [GNU Screen][3] but more modern and more intuitive. It also works on most Linux, BSD, and Mac distributions. - -Byobu allows you to maintain multiple terminal windows, connect via SSH (secure shell), disconnect, reconnect, and even let other people access it, all while keeping the session alive. - -For example, if you are SSH'd into a Raspberry Pi or server and run (for example) **sudo apt update && sudo apt upgrade**—and lose your internet connection while it is running, your command will be lost to the void. However, if you start a byobu session first, it will continue running and, when you reconnect, you will find it's been running happily without your eyes on it. - -![The byobu logo is a fun play on screens.][4] - -Byobu is named for a Japanese term for decorative, multi-panel screens that serve as folding room dividers, which I think is quite fitting. - -To install byobu on Debian/Raspbian/Ubuntu: - -**sudo apt install byobu** - -Then enable it: - -**byobu-enable** - -Now drop out of your SSH session and log back in—you'll land in a byobu session. Run a command like **sudo apt update** and close the window (or enter the escape sequence ([**Enter**+**~**+**.**][5]) and log back in. You'll see the update running just as you left it. - -There are a _lot_ of features I don't use regularly or at all. The most common ones I use are: - - * **F2** – New window - * **F3/F4** – Navigate between windows - * **Ctrl**+**F2** – Split pane vertically - * **Shift**+**F2** – Split pane horizontally - * **Shift**+**Left arrow/Shift**+**Right arrow** – Navigate between splits - * **Shift**+**F11** – Zoom in (or out) on a split - - - -You can learn more by watching this video: - -### How we're using byobu - -Byobu has been great for the maintenance of [piwheels][6], the convenient, pre-compiled Python packages for Raspberry Pi. We have a horizontal split showing the piwheels monitor in the top half and the syslog entries scrolled in real time on the bottom half. Then, if we want to do something else, we switch to another window. It's particularly handy when we're investigating something collaboratively, as I can see what my colleague Dave types (and correct his typos) while we chat in IRC. - -I have byobu enabled on my home and work servers, so when I log into either machine, everything is as I left it—multiple jobs running, a window left in a particular directory, running a process as another user, that kind of thing. - -![byobu screenshot][7] - -Byobu is handy for development on Raspberry Pis, too. You can launch it on the desktop, run a command, then SSH in and attach yourself to the session where that command is running. Just note that enabling byobu won't change what the terminal launcher does. Just run **byobu** to launch it. - -* * * - -_This article originally appeared on Ben Nuttall's [Tooling blog][8] and is reused with permission._ - -Enter the black raspberry. Rubus occidentalis . It's an ominous name for an ominous fruit: the... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/byobu-ssh - -作者:[Ben Nuttall][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/bennuttall -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) -[2]: https://byobu.org/ -[3]: http://www.gnu.org/software/screen/ -[4]: https://opensource.com/sites/default/files/uploads/byobu.png (byobu screen) -[5]: https://www.google.com/search?client=ubuntu&channel=fs&q=Enter-tilde-dot&ie=utf-8&oe=utf-8 -[6]: https://opensource.com/article/20/1/piwheels -[7]: https://opensource.com/sites/default/files/uploads/byobu-screenshot.png (byobu screenshot) -[8]: https://tooling.bennuttall.com/byobu/ diff --git a/translated/tech/20200212 How to use byobu to multiplex SSH sessions.md b/translated/tech/20200212 How to use byobu to multiplex SSH sessions.md new file mode 100644 index 0000000000..9c871b4840 --- /dev/null +++ b/translated/tech/20200212 How to use byobu to multiplex SSH sessions.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use byobu to multiplex SSH sessions) +[#]: via: (https://opensource.com/article/20/2/byobu-ssh) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +如何使用 byobu 复用 SSH 会话 +====== +Byobu 能让你在保持会话活跃的情况下维护多个终端窗口、通过 SSH 连接、断开、重连以及共享访问。 +![Person drinking a hat drink at the computer][1] + +[Byobu][2] 是基于文本的窗口管理器和终端多路复用器。它类似于 [GNU Screen][3],但更现代,更直观。它还适用于大多数 Linux、BSD 和 Mac 发行版。 + +Byobu 能让你在保持会话活跃的情况下维护多个终端窗口、通过 SSH (secure shell)连接、断开、重连,甚至让其他人访问。 + +比如,你 SSH 进入树莓派或服务器,并运行(比如) **sudo apt update && sudo apt upgrade**,然后你在它运行的时候失去了互联网连接,你的命令会丢失无效。然而,如果你首先启动 byobu 会话,那么它会继续运行,在你重连后,你会发现它仍在继续运行。 + +![The byobu logo is a fun play on screens.][4] + +Byobu 的日语术语是指装饰性多面板屏风,可作为折叠式隔断,我认为这很合适。 + +要在 Debian/Raspbian/Ubuntu 上安装 byobu: + +**sudo apt install byobu** + +接着启用它 + +**byobu-enable** + +现在,请退出 SSH 会话并重新登录,你将会在 byobu 会话中登录。运行类似 **sudo apt update** 命令并关闭窗口(或输入转义序列([**Enter**+**~**+**.**][5])并重新登录。你将看到更新在你离开后还在运行。 + +有_很多_我不常使用的功能。我通常使用的是: + + * **F2** – 新窗口 + * **F3/F4** – 在窗口间导航 + * **Ctrl**+**F2** – 垂直拆分窗格 + * **Shift**+**F2** – 水平拆分窗格 + * **Shift**+**左箭头/Shift**+**右箭头** – 在拆分窗格间导航 + * **Shift**+**F11** – 放大(或缩小)拆分窗格 + + +### 我们如何使用 byobu + +Byobu 对于 [piwheels][6](一个用于树莓派的方便的,预编译 Python 包)的维护很方便。我门水平拆分了窗格,在上半部分显示了 piwheels 监视器,在下半部分实时显示了 syslog 条目。接着,如果我们想要做其他事情,我们可以切换到另外一个窗口。当我们进行协作调查时,这特别方便,因为当我在 IRC 中聊天时,我可以看到我的同事 Dave 输入了什么(并纠正他的错字)。 + +我在家庭和办公服务器上启用了 byobu,因此,当我登录到任何一台计算机时,一切都与我离开时一样。它正在运行多个作业、在特定目录中保留一个窗口,以另一个用户身份运行进程等。 + +![byobu screenshot][7] + +Byobu 也很方便用于在树莓派上进行开发。你可以在桌面上启动它,运行命令,然后 SSH 进入,并连接到该命令运行所在的会话。请注意,启用 byobu 不会更改终端启动器的功能。只需运行 **byobu** 即可启动它。 + +* * * + +_本文最初发表在 Ben Nuttall 的 [Tooling blog][8] 中,并获许重用_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/byobu-ssh + +作者:[Ben Nuttall][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/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://byobu.org/ +[3]: http://www.gnu.org/software/screen/ +[4]: https://opensource.com/sites/default/files/uploads/byobu.png (byobu screen) +[5]: https://www.google.com/search?client=ubuntu&channel=fs&q=Enter-tilde-dot&ie=utf-8&oe=utf-8 +[6]: https://opensource.com/article/20/1/piwheels +[7]: https://opensource.com/sites/default/files/uploads/byobu-screenshot.png (byobu screenshot) +[8]: https://tooling.bennuttall.com/byobu/ From 65562443cff06ba0b4e75cb180d500ad2f749896 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 27 Feb 2020 08:43:21 +0800 Subject: [PATCH 108/260] translating --- ... Build your own cloud with Fedora 31 and Nextcloud Server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md b/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md index 69b8ad9e06..5aa4ee5023 100644 --- a/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md +++ b/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5b335551e91e6cfc08dcd5bc47fdc56f1a47f9d3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Feb 2020 09:41:36 +0800 Subject: [PATCH 109/260] Rename sources/tech/20200226 How we decide when to release Fedora.md to sources/talk/20200226 How we decide when to release Fedora.md --- .../20200226 How we decide when to release Fedora.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200226 How we decide when to release Fedora.md (100%) diff --git a/sources/tech/20200226 How we decide when to release Fedora.md b/sources/talk/20200226 How we decide when to release Fedora.md similarity index 100% rename from sources/tech/20200226 How we decide when to release Fedora.md rename to sources/talk/20200226 How we decide when to release Fedora.md From 5c2e49cb9fe68f98e0df10b3b27bef7e18c6e953 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 27 Feb 2020 10:29:42 +0800 Subject: [PATCH 110/260] PRF @geekpi --- ...0 Scan Kubernetes for errors with KRAWL.md | 186 +++++++++--------- 1 file changed, 92 insertions(+), 94 deletions(-) diff --git a/translated/tech/20200210 Scan Kubernetes for errors with KRAWL.md b/translated/tech/20200210 Scan Kubernetes for errors with KRAWL.md index dae3043217..ef33fd24c8 100644 --- a/translated/tech/20200210 Scan Kubernetes for errors with KRAWL.md +++ b/translated/tech/20200210 Scan Kubernetes for errors with KRAWL.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Scan Kubernetes for errors with KRAWL) @@ -9,25 +9,25 @@ 使用 KRAWL 扫描 Kubernetes 错误 ====== -用 KRAWL 脚本来标识 Kubernetes pod 和容器中的错误。 + +> 用 KRAWL 脚本来识别 Kubernetes Pod 和容器中的错误。 + ![Ship captain sailing the Kubernetes seas][1] -当你使用 Kubernetes 运行容器时,你通常会发现它们堆积。这是设计使然。它是容器的优点之一:每当需要新的容器时,它们启动成本都很低。你可以使用前端(如 OpenShift 或 OKD)来管理 pod 和容器。这些工具使可视化设置变得容易,并且它具有一组丰富的用于快速交互的命令。 +当你使用 Kubernetes 运行容器时,你通常会发现它们堆积在一起。这是设计使然。它是容器的优点之一:每当需要新的容器时,它们启动成本都很低。你可以使用前端工具(如 OpenShift 或 OKD)来管理 Pod 和容器。这些工具使可视化设置变得容易,并且它具有一组丰富的用于快速交互的命令。 -如果管理容器的平台不符合你的要求,你也可以仅使用 Kubernetes 工具链获取这些信息,但这需要大量命令才能全面了解复杂环境。出于这个原因,我编写了 [KRAWL][2],这是一个简单的脚本,可用于扫描 Kubernetes 集群命名空间下的 pod 和容器,并在发现任何事件时,显示事件的输出。它也可用作为 Kubernetes 插件使用。这是获取大量有用信息的快速简便方法。 - -### 预先条件 - - * 必须安装 kubectl。 - * 集群的 kubeconfig 配置必须在它的默认位置 ($HOME/.kube/config) 或已被导出。 +如果管理容器的平台不符合你的要求,你也可以仅使用 Kubernetes 工具链获取这些信息,但这需要大量命令才能全面了解复杂环境。出于这个原因,我编写了 [KRAWL][2],这是一个简单的脚本,可用于扫描 Kubernetes 集群命名空间下的 Pod 和容器,并在发现任何事件时,显示事件的输出。它也可用作为 Kubernetes 插件使用。这是获取大量有用信息的快速简便方法。 +### 先决条件 + * 必须安装 `kubectl`。 + * 集群的 kubeconfig 配置必须在它的默认位置(`$HOME/.kube/config`)或已被导出到环境变量(`KUBECONFIG=/path/to/kubeconfig`)。 ### 使用 ``` -`$ ./krawl` +$ ./krawl ``` ![KRAWL script][3] @@ -38,20 +38,20 @@ ``` #!/bin/bash # AUTHOR: Abhishek Tamrakar -# EMAIL: [abhishek.tamrakar08@gmail.com][4] +# EMAIL: abhishek.tamrakar08@gmail.com # LICENSE: Copyright (C) 2018 Abhishek Tamrakar # -#  Licensed under the Apache License, Version 2.0 (the "License"); -#  you may not use this file except in compliance with the License. -#  You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -#       +# http://www.apache.org/licenses/LICENSE-2.0 # -#   Unless required by applicable law or agreed to in writing, software -#   distributed under the License is distributed on an "AS IS" BASIS, -#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -#   See the License for the specific language governing permissions and -#   limitations under the License. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ## #define the variables KUBE_LOC=~/.kube/config @@ -66,102 +66,102 @@ normal=$(tput sgr0) # wrapper for printing info messages info() { -  printf '\n\e[34m%s\e[m: %s\n' "INFO" "$@" + printf '\n\e[34m%s\e[m: %s\n' "INFO" "$@" } # cleanup when all done cleanup() { -  rm -f results.csv + rm -f results.csv } # just check if the command we are about to call is available checkcmd() { -  #check if command exists -  local cmd=$1 -  if [ -z "${!cmd}" ] -  then -    printf '\n\e[31m%s\e[m: %s\n' "ERROR"  "check if $1 is installed !!!" -    exit 1 -  fi + #check if command exists + local cmd=$1 + if [ -z "${!cmd}" ] + then + printf '\n\e[31m%s\e[m: %s\n' "ERROR" "check if $1 is installed !!!" + exit 1 + fi } get_namespaces() { -  #get namespaces -  namespaces=( \ -          $($KUBECTL get namespaces --ignore-not-found=true | \ -          $AWK '/Active/ {print $1}' \ -          ORS=" ") \ -          ) + #get namespaces + namespaces=( \ + $($KUBECTL get namespaces --ignore-not-found=true | \ + $AWK '/Active/ {print $1}' \ + ORS=" ") \ + ) #exit if namespaces are not found if [ ${#namespaces[@]} -eq 0 ] then -  printf '\n\e[31m%s\e[m: %s\n' "ERROR"  "No namespaces found!!" -  exit 1 + printf '\n\e[31m%s\e[m: %s\n' "ERROR" "No namespaces found!!" + exit 1 fi } #get events for pods in errored state get_pod_events() { -  printf '\n' -  if [ ${#ERRORED[@]} -ne 0 ] -  then -      info "${#ERRORED[@]} errored pods found." -      for CULPRIT in ${ERRORED[@]} -      do -        info "POD: $CULPRIT" -        info -        $KUBECTL get events \ -        --field-selector=involvedObject.name=$CULPRIT \ -        -ocustom-columns=LASTSEEN:.lastTimestamp,REASON:.reason,MESSAGE:.message \ -        --all-namespaces \ -        --ignore-not-found=true -      done -  else -      info "0 pods with errored events found." -  fi + printf '\n' + if [ ${#ERRORED[@]} -ne 0 ] + then + info "${#ERRORED[@]} errored pods found." + for CULPRIT in ${ERRORED[@]} + do + info "POD: $CULPRIT" + info + $KUBECTL get events \ + --field-selector=involvedObject.name=$CULPRIT \ + -ocustom-columns=LASTSEEN:.lastTimestamp,REASON:.reason,MESSAGE:.message \ + --all-namespaces \ + --ignore-not-found=true + done + else + info "0 pods with errored events found." + fi } #define the logic get_pod_errors() { -  printf "%s %s %s\n" "NAMESPACE,POD_NAME,CONTAINER_NAME,ERRORS" > results.csv -  printf "%s %s %s\n" "---------,--------,--------------,------" >> results.csv -  for NAMESPACE in ${namespaces[@]} -  do -    while IFS=' ' read -r POD CONTAINERS -    do -      for CONTAINER in ${CONTAINERS//,/ } -      do -        COUNT=$($KUBECTL logs --since=1h --tail=20 $POD -c $CONTAINER -n $NAMESPACE 2>/dev/null| \ -        $GET -c '^error|Error|ERROR|Warn|WARN') -        if [ $COUNT -gt 0 ] -        then -            STATE=("${STATE[@]}" "$NAMESPACE,$POD,$CONTAINER,$COUNT") -        else -        #catch pods in errored state -            ERRORED=($($KUBECTL get pods -n $NAMESPACE --no-headers=true | \ -                awk '!/Running/ {print $1}' ORS=" ") \ -                ) -        fi -      done -    done< <($KUBECTL get pods -n $NAMESPACE --ignore-not-found=true -o=custom-columns=NAME:.metadata.name,CONTAINERS:.spec.containers[*].name --no-headers=true) -  done -  printf "%s\n" ${STATE[@]:-None} >> results.csv -  STATE=() + printf "%s %s %s\n" "NAMESPACE,POD_NAME,CONTAINER_NAME,ERRORS" > results.csv + printf "%s %s %s\n" "---------,--------,--------------,------" >> results.csv + for NAMESPACE in ${namespaces[@]} + do + while IFS=' ' read -r POD CONTAINERS + do + for CONTAINER in ${CONTAINERS//,/ } + do + COUNT=$($KUBECTL logs --since=1h --tail=20 $POD -c $CONTAINER -n $NAMESPACE 2>/dev/null| \ + $GET -c '^error|Error|ERROR|Warn|WARN') + if [ $COUNT -gt 0 ] + then + STATE=("${STATE[@]}" "$NAMESPACE,$POD,$CONTAINER,$COUNT") + else + #catch pods in errored state + ERRORED=($($KUBECTL get pods -n $NAMESPACE --no-headers=true | \ + awk '!/Running/ {print $1}' ORS=" ") \ + ) + fi + done + done< <($KUBECTL get pods -n $NAMESPACE --ignore-not-found=true -o=custom-columns=NAME:.metadata.name,CONTAINERS:.spec.containers[*].name --no-headers=true) + done + printf "%s\n" ${STATE[@]:-None} >> results.csv + STATE=() } #define usage for seprate run usage() { -cat << EOF +cat << EOF -  USAGE: "${0##*/} </path/to/kube-config>(optional)" + USAGE: "${0##*/} (optional)" -  This program is a free software under the terms of Apache 2.0 License. -  COPYRIGHT (C) 2018 Abhishek Tamrakar + This program is a free software under the terms of Apache 2.0 License. + COPYRIGHT (C) 2018 Abhishek Tamrakar EOF exit 0 @@ -173,17 +173,17 @@ checkcmd KUBECTL # #set the ground if [ $# -lt 1 ]; then -  if [ ! -e ${KUBE_LOC} -a ! -s ${KUBE_LOC} ] -  then -    info "A readable kube config location is required!!" -    usage -  fi + if [ ! -e ${KUBE_LOC} -a ! -s ${KUBE_LOC} ] + then + info "A readable kube config location is required!!" + usage + fi elif [ $# -eq 1 ] then -  export KUBECONFIG=$1 + export KUBECONFIG=$1 elif [ $# -gt 1 ] then -  usage + usage fi #play get_namespaces @@ -191,7 +191,7 @@ get_pod_errors printf '\n%40s\n' 'KRAWL' printf '%s\n' '---------------------------------------------------------------------------------' -printf '%s\n' '  Krawl is a command line utility to scan pods and prints name of errored pods   ' +printf '%s\n' ' Krawl is a command line utility to scan pods and prints name of errored pods ' printf '%s\n\n' ' +and containers within. To use it as kubernetes plugin, please check their page ' printf '%s\n' '=================================================================================' @@ -199,9 +199,7 @@ cat results.csv | sed 's/,/,|/g'| column -s ',' -t get_pod_events ``` -* * * - -_此文最初发布在 [KRAWL 的 GitHub 仓库][2]下的 README 中,并被或许重用。_ +此文最初发布在 [KRAWL 的 GitHub 仓库][2]下的 README 中,并被或许重用。 -------------------------------------------------------------------------------- @@ -210,7 +208,7 @@ via: https://opensource.com/article/20/2/kubernetes-scanner 作者:[Abhishek Tamrakar][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 14bb061b533ed2726d5822aca0860a03fc80a7a8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 27 Feb 2020 10:30:13 +0800 Subject: [PATCH 111/260] PUB @geekpi https://linux.cn/article-11936-1.html --- .../20200210 Scan Kubernetes for errors with KRAWL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200210 Scan Kubernetes for errors with KRAWL.md (98%) diff --git a/translated/tech/20200210 Scan Kubernetes for errors with KRAWL.md b/published/20200210 Scan Kubernetes for errors with KRAWL.md similarity index 98% rename from translated/tech/20200210 Scan Kubernetes for errors with KRAWL.md rename to published/20200210 Scan Kubernetes for errors with KRAWL.md index ef33fd24c8..22fcd2a098 100644 --- a/translated/tech/20200210 Scan Kubernetes for errors with KRAWL.md +++ b/published/20200210 Scan Kubernetes for errors with KRAWL.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11936-1.html) [#]: subject: (Scan Kubernetes for errors with KRAWL) [#]: via: (https://opensource.com/article/20/2/kubernetes-scanner) [#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) From 9ca40c0db824d6b8733b90eaac1a63ab903c0d62 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 27 Feb 2020 12:06:17 +0800 Subject: [PATCH 112/260] PRF @lujun9972 --- ...ice for How to Make Emacs Tetris Harder.md | 61 ++++++++----------- 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md b/translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md index 81d107ec69..8a93358ece 100644 --- a/translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md +++ b/translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md @@ -1,30 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Some Advice for How to Make Emacs Tetris Harder) [#]: via: (https://nickdrozd.github.io/2019/01/14/tetris.html) [#]: author: (nickdrozd https://nickdrozd.github.io) -让 Emacs 俄罗斯方块变得更难的一些建议 (Advice) +如何让 Emacs 俄罗斯方块变得更难 ====== -你知道吗,**Emacs** 与 **俄罗斯方块** 的实现捆绑在一起了?只需要输入 `M-x tetris` 就行了。 +你知道吗,Emacs 捆绑了一个俄罗斯方块的实现?只需要输入 `M-x tetris` 就行了。 -![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-normal.png) +![](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-normal.png) -在文本编辑器讨论中,Emacs 倡导者经常提到这一点。“没错,但是那个编辑器能运行俄罗斯方块吗?” -我很好奇,这会让大家相信 Emacs 更优秀吗?比如,为什么有人会关心他们是否可以在文本编辑器中玩游戏呢?“是的,但是那台吸尘器能播放 mp3 吗?” +在对文本编辑器的讨论中,Emacs 鼓吹者经常提到这一点。“没错,但是你那个编辑器能运行俄罗斯方块吗?”我很好奇,这会让大家相信 Emacs 更优秀吗?比如,为什么有人会关心他们是否可以在文本编辑器中玩游戏呢?“没错,但是你那台吸尘器能播放 mp3 吗?” -有人说,俄罗斯方块总是很有趣的。像 Emacs 中的所有东西一样,它的源代码是开放的,易于检查和修改,因此 **我们可以使它变得更加有趣**。所谓更多的乐趣,我意思是更难。 +有人说,俄罗斯方块总是很有趣的。像 Emacs 中的所有东西一样,它的源代码是开放的,易于检查和修改,因此 **我们可以使它变得更加有趣**。所谓更加有趣,我的意思是更难。 -让游戏变得更困难的一个最简单的方法就是“不要下一个块预览”。你无法再在知道下一个块会填满空间的情况下有意地将 S/Z 块放在一个危险的位置——你必须碰碰运气,希望出现最好的情况。 -下面是没有预览的情况(如你所见,没有预览,我做出的某些选择带来了“可怕的后果”): +让游戏变得更难的一个最简单的方法就是“隐藏下一个块预览”。你无法在知道下一个块会填满空间的情况下有意地将 S/Z 块放在一个危险的位置——你必须碰碰运气,希望出现最好的情况。下面是没有预览的情况(如你所见,没有预览,我做出的某些选择带来了“可怕的后果”): -![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-no-preview.png) +![](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-no-preview.png) -预览框由一个名为 `tetris-draw-next-shape` 的函数设置: +预览框由一个名为 `tetris-draw-next-shape` [^1] 的函数设置: ``` (defun tetris-draw-next-shape () @@ -43,7 +41,7 @@ tetris-shape)))) ``` -首先,我们引入一个标志,决定是否允许显示下一个预览块: +首先,我们引入一个标志,决定是否允许显示下一个预览块 [^2]: ``` (defvar tetris-preview-next-shape nil @@ -63,7 +61,7 @@ 一个更好的方法是使用 **advice**。Emacs 的 advice 类似于 **Python 装饰器**,但是更加灵活,因为 advice 可以从任何地方添加到函数中。这意味着我们可以修改函数而不影响原始的源文件。 -有很多不同的方法使用 Emacs advice([ 查看手册 ][4]),但是这里我们只使用 `advice-add` 函数和 `:around` 标志。advise 函数将原始函数作为参数,原始函数可能执行也可能不执行。我们这里,我们让原始函数只有在预览标志是非空的情况下才能执行: +有很多不同的方法使用 Emacs advice([查看手册][4]),但是这里我们只使用 `advice-add` 函数和 `:around` 标志。advice 函数将原始函数作为参数,原始函数可能执行也可能不执行。我们这里,我们让原始函数只有在预览标志是非空的情况下才能执行: ``` (defun tetris-maybe-draw-next-shape (tetris-draw-next-shape) @@ -75,11 +73,11 @@ 这段代码将修改 `tetris-draw-next-shape` 的行为,而且它可以存储在配置文件中,与实际的俄罗斯方块代码分离。 -去掉预览框是一个简单的改变。一个更激烈的变化是,**让块随机停止在空中**: +去掉预览框是一个简单的改变。一个更激烈的变化是,**让块随机停止在空中**: -![img](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-air.png) +![](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-air.png) -本图中,红色的 I 和绿色的 T 部分没有掉下来,它们被固定下来了。这会让游戏变得 **及其难玩**,但却很容易实现。 +本图中,红色的 I 和绿色的 T 部分没有掉下来,它们被固定下来了。这会让游戏变得 **极其困难**,但却很容易实现。 和前面一样,我们首先定义一个标志: @@ -88,10 +86,9 @@ "If non-nil, pieces will sometimes stop in the air.") ``` -目前,**Emacs 俄罗斯方块的工作方式** 类似这样子:活动部件有 x 和 y 坐标。在每个时钟滴答声中,y 坐标递增(块向下移动一行),然后检查是否有与现存的块重叠。 -如果检测到重叠,则将该块回退(其 y 坐标递减)并设置该活动块到位。为了让一个块在半空中停下来,我们所要做的就是破解检测函数 `tetris-test-shape`。 +目前,**Emacs 俄罗斯方块的工作方式** 类似这样子:活动部件有 x 和 y 坐标。在每个时钟滴答声中,y 坐标递增(块向下移动一行),然后检查是否有与现存的块重叠。如果检测到重叠,则将该块回退(其 y 坐标递减)并设置该活动块到位。为了让一个块在半空中停下来,我们所要做的就是破解检测函数 `tetris-test-shape`。 -**这个函数内部做什么并不重要** —— 重要的是它是一个返回布尔值的无参数函数。我们需要它在正常情况下返回布尔值 true( 否则我们将出现奇怪的重叠情况),但在其他时候也需要它返回 true。我相信有很多方法可以做到这一点,以下是我的方法的: +**这个函数内部做什么并不重要** —— 重要的是它是一个返回布尔值的无参数函数。我们需要它在正常情况下返回布尔值 true(否则我们将出现奇怪的重叠情况),但在其他时候也需要它返回 true。我相信有很多方法可以做到这一点,以下是我的方法的: ``` (defun tetris-test-shape-random (tetris-test-shape) @@ -114,7 +111,7 @@ 这里的硬编码参数使游戏变得更困难,但仍然可玩。当时我在飞机上喝醉了,所以它们可能需要进一步调整。 -顺便说一下,根据我的 `tetris-scores` 文件,我的 **最高分** 是 +顺便说一下,根据我的 `tetris-scores` 文件,我的 **最高分** 是: ``` 01389 Wed Dec 5 15:32:19 2018 @@ -122,23 +119,15 @@ 该文件中列出的分数默认最多为五位数,因此这个分数看起来不是很好。 -**给读者的练习** +### 给读者的练习 -1。使用 advice 修改 Emacs 俄罗斯方块,使得每当方块下移动时就闪烁显示讯息 “OH SHIT”。消息的大小与块堆的高度成比例(当没有块时,消息应该很小的或不存在的,当最高块接近天花板时,消息应该很大)。 +1. 使用 advice 修改 Emacs 俄罗斯方块,使得每当方块下移动时就闪烁显示讯息 “OH SHIT”。消息的大小与块堆的高度成比例(当没有块时,消息应该很小的或不存在的,当最高块接近天花板时,消息应该很大)。 +2. 在这里给出的 `tetris-test-shape-random` 版本中,每隔七格就有一个半空中停止。一个玩家有可能能计算出时间间隔,并利用它来获得优势。修改它,使间隔随机在一些合理的范围内(例如,每 5 到 10 格)。 +3. 另一个对使用 Tetris 使用 advise 的场景,你可以试试 [autotetris-mode][1]。 +4. 想出一个有趣的方法来打乱块的旋转机制,然后使用 advice 来实现它。 -2。在这里给出的 `tetris-test-shape-random` 版本中,每隔七格就有一个半空中停止。一个玩家有可能能计算出时间间隔,并利用它来获得优势。修改它,使间隔随机在一些合理的范围内(例如,每 5 到 10 格)。 - -3。另一个对使用 Tetris 使用 advise 的场景,你可以试试 [`autotetris-mode`][1]。 - -4。想出一个有趣的方法来打乱块的旋转机制,然后使用 advice 来实现它。 - - -附注 -============================================================ - -[1][5] Emacs 只有一个巨大的全局命名空间,因此函数和变量名一般以包名做前缀以避免冲突。 - -[2][6] 很多人会说你不应该使用已有的命名空间前缀而且应该将自己定义的所有东西都放在一个预留的命名空间中,比如像这样 `my/tetris-preview-next-shape`,然而这样很难看而且没什么意义,因此我不会这么干。 +[^1]: Emacs 只有一个巨大的全局命名空间,因此函数和变量名一般以包名做前缀以避免冲突。 +[^2]: 很多人会说你不应该使用已有的命名空间前缀而且应该将自己定义的所有东西都放在一个预留的命名空间中,比如像这样 `my/tetris-preview-next-shape`,然而这样很难看而且没什么意义,因此我不会这么干。 -------------------------------------------------------------------------------- @@ -147,7 +136,7 @@ via: https://nickdrozd.github.io/2019/01/14/tetris.html 作者:[nickdrozd][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 69f356b6eaeb02e45e1a1e1128f55f3a714b6311 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 27 Feb 2020 12:06:49 +0800 Subject: [PATCH 113/260] PUB @lujun9972 https://linux.cn/article-11938-1.html --- ...0190114 Some Advice for How to Make Emacs Tetris Harder.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190114 Some Advice for How to Make Emacs Tetris Harder.md (99%) diff --git a/translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md b/published/20190114 Some Advice for How to Make Emacs Tetris Harder.md similarity index 99% rename from translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md rename to published/20190114 Some Advice for How to Make Emacs Tetris Harder.md index 8a93358ece..7e06e1b241 100644 --- a/translated/tech/20190114 Some Advice for How to Make Emacs Tetris Harder.md +++ b/published/20190114 Some Advice for How to Make Emacs Tetris Harder.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11938-1.html) [#]: subject: (Some Advice for How to Make Emacs Tetris Harder) [#]: via: (https://nickdrozd.github.io/2019/01/14/tetris.html) [#]: author: (nickdrozd https://nickdrozd.github.io) From 3b44f1508fa2c6725ece77dedc6f7ec3a27de0db Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Thu, 27 Feb 2020 13:15:30 +0800 Subject: [PATCH 114/260] hankchow translating --- ...t developers need to know about domain-specific languages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200224 What developers need to know about domain-specific languages.md b/sources/tech/20200224 What developers need to know about domain-specific languages.md index 8c274f42b8..422d91eb22 100644 --- a/sources/tech/20200224 What developers need to know about domain-specific languages.md +++ b/sources/tech/20200224 What developers need to know about domain-specific languages.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e00988555ae953b8b8f4d94e40f564f444052f65 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Thu, 27 Feb 2020 20:30:15 +0800 Subject: [PATCH 115/260] hankchow translated --- ...to know about domain-specific languages.md | 130 ------------------ ...to know about domain-specific languages.md | 130 ++++++++++++++++++ 2 files changed, 130 insertions(+), 130 deletions(-) delete mode 100644 sources/tech/20200224 What developers need to know about domain-specific languages.md create mode 100644 translated/tech/20200224 What developers need to know about domain-specific languages.md diff --git a/sources/tech/20200224 What developers need to know about domain-specific languages.md b/sources/tech/20200224 What developers need to know about domain-specific languages.md deleted file mode 100644 index 422d91eb22..0000000000 --- a/sources/tech/20200224 What developers need to know about domain-specific languages.md +++ /dev/null @@ -1,130 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What developers need to know about domain-specific languages) -[#]: via: (https://opensource.com/article/20/2/domain-specific-languages) -[#]: author: (Girish Managoli https://opensource.com/users/gammay) - -What developers need to know about domain-specific languages -====== -DSLs are used for a specific context in a particular domain. Learn more -about what they are and why you might want to use one. -![Various programming languages in use][1] - -A [domain-specific language][2] (DSL) is a language meant for use in the context of a particular domain. A domain could be a business context (e.g., banking, insurance, etc.) or an application context (e.g., a web application, database, etc.) In contrast, a general-purpose language (GPL) can be used for a wide range of business problems and applications. - -A DSL does not attempt to please all. Instead, it is created for a limited sphere of applicability and use, but it's powerful enough to represent and address the problems and solutions in that sphere. A good example of a DSL is HTML. It is a language for the web application domain. It can't be used for, say, number crunching, but it is clear how widely used HTML is on the web. - -A GPL creator does not know where the language might be used or the problems the user intends to solve with it. So, a GPL is created with generic constructs that potentially are usable for any problem, solution, business, or need. Java is a GPL, as it's used on desktops and mobile devices, embedded in the web across banking, finance, insurance, manufacturing, etc., and more. - -### Classifying DSLs - -In the DSL world, there are two types of languages: - - * **Domain-specific language (DSL):** The language in which a DSL is written or presented - * **Host language:** The language in which a DSL is executed or processed - - - -A DSL written in a distinct language and processed by another host language is called an **external** DSL. - -This is a DSL in SQL that can be processed in a host language: - - -``` -SELECT account -FROM accounts -WHERE account = '123' AND branch = 'abc' AND amount >= 1000 -``` - -For that matter, a DSL could be written in English with a defined vocabulary and form that can be processed in another host language using a parser generator like ANTLR: - - -``` -`if smokes then increase premium by 10%` -``` - -If the DSL and host language are the same, then the DSL type is **internal**, where the DSL is written in the language's semantics and processed by it. These are also referred to as **embedded** DSLs. Here are two examples. - - * A Bash DSL that can be executed in a Bash engine: [code]`if today_is_christmas; then apply_christmas_discount; fi` [/code] This is valid Bash that is written like English. - * A DSL written in a GPL like Java: [code] orderValue = orderValue -                .applyFestivalDiscount() -                .applyCustomerLoyalityDiscount() -                .applyCustomerAgeDiscount(); [/code] This uses a fluent style and is readable like English. - - - -Yes, the boundaries between DSL and GPL sometimes blur. - -### DSL examples - -Some languages used for DSLs include: - - * Web: HTML - * Shell: sh, Bash, CSH, and the likes for *nix; MS-DOS, Windows Terminal, PowerShell for Windows - * Markup languages: XML - * Modeling: UML - * Data management: SQL and its variants - * Business rules: Drools - * Hardware: Verilog, VHD - * Build tools: Maven, Gradle - * Numerical computation and simulation: MATLAB (commercial), GNU Octave, Scilab - * Various types of parsers and generators: Lex, YACC, GNU Bison, ANTLR - - - -### Why DSL? - -The purpose of a DSL is to capture or document the requirements and behavior of one domain. A DSL's usage might be even narrower for particular aspects within the domain (e.g., commodities trading in finance). DSLs bring business and technical teams together. This does not imply a DSL is for business use alone. For example, designers and developers can use a DSL to represent or design an application. - -A DSL can also be used to generate source code for an addressed domain or problem. However, code generation from a DSL is not considered mandatory, as its primary purpose is domain knowledge. However, when it is used, code generation is a serious advantage in domain engineering. - -### DSL pros and cons - -On the plus side, DSLs are powerful for capturing a domain's attributes. Also, since DSLs are small, they are easy to learn and use. Finally, a DSL offers a language for domain experts and between domain experts and developers. - -On the downside, a DSL is narrowly used within the intended domain and purpose. Also, a DSL has a learning curve, although it may not be very high. Additionally, although there may be advantages to using tools for DSL capture, they are not essential, and the development or configuration of such tools is an added effort. Finally, DSL creators need domain knowledge as well as language-development knowledge, and individuals rarely have both. - -### DSL software options - -Open source DSL software options include: - - * **Xtext:** Xtext enables the development of DSLs and is integrated with Eclipse. It makes code generation possible and has been used by several open source and commercial products to provide specific functions. [MADS][3] (Multipurpose Agricultural Data System) is an interesting idea based on Xtext for "modeling and analysis of agricultural activities" (however, the project seems to be no longer active). - * **JetBrains MPS:** JetBrains MPS is an integrated development environment (IDE) to create DSLs. It calls itself a projectional editor that stores a document as its underlying abstract tree structure. (This concept is also used by programs such as Microsoft Word.) JetBrains MPS also supports code generation to Java, C, JavaScript, or XML. - - - -### DSL best practices - -Want to use a DSL? Here are a few tips: - - * DSLs are not GPLs. Try to address limited ranges of problems in the definitive domain. - * You do not need to define your own DSL. That would be tedious. Look for an existing DSL that solves your need on sites like [DSLFIN][4], which lists DSLs for the finance domain. If you are unable to find a suitable DSL, you could define your own. - * It is better to make DSLs "like English" rather than too technical. - * Code generation from a DSL is not mandatory, but it offers significant and productive advantages when it is done. - * DSLs are called languages but, unlike GPLs, they need not be executable. Being executable is not the intent of a DSL. - * DSLs can be written with word processors. However, using a DSL editor makes syntax and semantics checks easier. - - - -If you are using DSL now or plan to do so in the future, please share your experience in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/domain-specific-languages - -作者:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_language_c.png?itok=mPwqDAD9 (Various programming languages in use) -[2]: https://en.wikipedia.org/wiki/Domain-specific_language -[3]: http://mads.sourceforge.net/ -[4]: http://www.dslfin.org/resources.html diff --git a/translated/tech/20200224 What developers need to know about domain-specific languages.md b/translated/tech/20200224 What developers need to know about domain-specific languages.md new file mode 100644 index 0000000000..299ed726fc --- /dev/null +++ b/translated/tech/20200224 What developers need to know about domain-specific languages.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What developers need to know about domain-specific languages) +[#]: via: (https://opensource.com/article/20/2/domain-specific-languages) +[#]: author: (Girish Managoli https://opensource.com/users/gammay) + + +开发者需要了解的领域特定语言 +====== +> 领域特定语言是在特定领域下用于特定上下文的语言。作为开发者,很有必要了解领域特定语言的含义,以及为什么要使用特定领域语言。 + +![Various programming languages in use][1] + +领域特定语言domain-specific language(DSL)是在特定领域下用于特定上下文的语言。这里的领域是指某种商业上的(例如银行业、保险业等)上下文,也可以指某种应用程序的(例如 Web 应用、数据库等)上下文。与之相比的另一个概念是通用语言general-purpose language(GPL),通用语言则可以广泛应用于各种商业或应用问题当中。 + +DSL 并不具备很强的普适性,它是仅为某个适用的领域而设计的,但它也足以用于表示这个领域中的问题以及构建对应的解决方案。HTML 是 DSL 的一个典型,它是在 Web 应用上使用的语言,尽管 HTML 无法进行数字运算,但也不影响它在这方面的广泛应用。 + +而 GPL 则没有特定针对的领域,GPL 的设计者不可能知道这种语言会在什么领域被使用,更不清楚用户打算解决的问题是什么,因此 GPL 会被设计成可用于解决任何一种问题、适合任何一种业务、满足任何一种需求。例如 Java 就属于 GPL,它可以在 PC 或移动设备上运行,嵌入到银行、金融、保险、制造业等各种行业的应用中去。 + +### DSL 的类别 + +从使用方式的角度,语言可以划分出以下两类: + + * DSL:使用 DSL 形式编写或表示的语言 + * 宿主语言host language:用于执行或处理 DSL 的语言 + +当 DSL 以独有的形式表达,并由另一种宿主语言来处理时,这种 DSL 称为外部external DSL。 + +以下就是可以在宿主语言中处理的 SQL: + + +``` +SELECT account +FROM accounts +WHERE account = '123' AND branch = 'abc' AND amount >= 1000 +``` + +因此,只要在规定了词汇和语法的情况下,DSL 也可以直接使用英语来编写,并使用诸如 ANTLR 这样的解析器生成器parser generator以另一种宿主语言来处理 DSL: + + +``` +`if smokes then increase premium by 10%` +``` + +如果 DSL 和宿主语言是同一种语言,这种 DSL 称为内部internal DSL,其中 DSL 由以同一种语义的宿主语言编写和处理,因此又称为嵌入式embedded DSL。以下是两个例子: + + * Bash 形式的 DSL 可以由 Bash 解释器执行:`if today_is_christmas; then apply_christmas_discount; fi` 同时这也是一段看起来符合英语语法的 Bash。 + * 使用类似 Java 语法编写的 DSL: +``` +orderValue = orderValue + .applyFestivalDiscount() + .applyCustomerLoyalityDiscount() + .applyCustomerAgeDiscount(); +``` +这一段的可读性也相当强。 + +实际上,DSL 和 GPL 之间并没有非常明确的界限。 + +### DSL 家族 + +以下这些语言都可以作为 DSL 使用: + + * Web 应用:HTML + * Shell:用于类 Unix 系统的 sh、Bash、CSH 等;用于 Windows 系统的 MS-DOS、Windows Terminal、PowerShell 等 + * 标记语言:XML + * 建模:UML + * 数据处理:SQL 及其变体 + * 业务规则管理:Drools + * 硬件:Verilog、VHD + * 构建工具:Maven、Gradle + * 数值计算和模拟:MATLAB(商业)、GNU Octave、Scilab + * 解析器和生成器:Lex、YACC、GNU Bison、ANTLR + + + +### 为什么要使用 DSL? + +DSL 的目的是在某个领域中记录一些需求和行为,在某些方面(例如金融商品交易)中,DSL 的适用场景可能更加狭窄。业务团队和技术团队能通过 DSL 有效地协同工作,因此 DSL 除了在业务用途上有所发挥,还可以让设计人员和开发人员用于设计和开发应用程序。 + +DSL 还可以用于生成一些用于解决特定问题的代码,但生成代码并不是 DSL 的重点并不在此,而是对专业领域知识的结合。当然,代码生成在领域工程中是一个巨大的优势。 + +### DSL 的优点和缺点 + +DSL 的优点是,它对于领域的特征捕捉得非常好,同时它不像 GPL 那样包罗万有,学习和使用起来相对比较简单。因此,它在专业人员之间、专业人员和开发人员之间都提供了一个沟通的桥梁。 + +而 DSL 最显著的缺点就在于它只能用于一个特定的领域和目标。尽管学习起来不算太难,但学习成本仍然存在。如果使用到 DSL 相关的工具,即使对工作效率有所提升,但开发或配置这些工具也会增加一定的工作负担。另外,如果要设计一款 DSL,设计者必须具备专业领域知识和语言开发知识,而同时具备这两种知识的人却少之又少。 + +### DSL 相关软件 + +开源的 DSL 软件包括: + + * Xtext:Xtext 可以与 Eclipse 集成,并支持 DSL 开发。它能够实现代码生成,因此一些开源和商业产品都用它来提供特定的功能。用于农业活动建模分析的多用途农业数据系统Multipurpose Agricultural Data System(MADS)就是基于 Xtext 实现的一个项目,可惜的是这个项目现在已经不太活跃了。 + * JetBrains MPS:JetBrains MPS 是一个可供开发 DSL 的集成开发环境Integrated Development Environment,它将文档在底层存储为一个抽象树结构(Microsoft Word 也使用了这一概念),因此它也自称为一个投影编辑器projectional editor。JetBrains MPS 支持 Java、C、JavaScript 和 XML 的代码生成。 + +### DSL 的最佳实践 + +如果你想使用 DSL,记住以下几点: + + * DSL 不同于 GPL,DSL 只能用于解决特定领域中有限范围内的问题。 + * 不必动辄建立自己的 DSL,可以首先尝试寻找已有的 DSL。例如 [DSLFIN][4] 这个网站就提供了很多金融方面的 DSL。在实在找不到合适的 DSL 的情况下,才需要建立自己的 DSL。 + * DSL 最好像平常的语言一样具有可读性。 + * 尽管代码生成不是一项必需的工作,但它确实会大大提高工作效率。 + * 虽然 DSL 被称为语言,但 DSL 不需要像 GPL 一样可以被执行,可执行性并不是 DSL 需要达到的目的。 + * DSL 可以使用文本编辑器编写,但专门的 DSL 编辑器可以更轻松地完成 DSL 的语法和语义检查。 + + + +如果你正在使用或将要使用 DSL,欢迎在评论区留言。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/domain-specific-languages + +作者:[Girish Managoli][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/gammay +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_language_c.png?itok=mPwqDAD9 (Various programming languages in use) +[2]: https://en.wikipedia.org/wiki/Domain-specific_language +[3]: http://mads.sourceforge.net/ +[4]: http://www.dslfin.org/resources.html From d240a751f23172fb579968220c48b787d4191db6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 27 Feb 2020 22:17:07 +0800 Subject: [PATCH 116/260] APL --- ... You Can Buy Open Source Apps for Your Linux Distribution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md b/sources/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md index 1019db718d..903c8418e1 100644 --- a/sources/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md +++ b/sources/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5665e4c58295257ed44cb1aa10949b3141ac68f0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 27 Feb 2020 23:33:28 +0800 Subject: [PATCH 117/260] TSL&PRF --- ...Source Apps for Your Linux Distribution.md | 97 ------------------- ...Source Apps for Your Linux Distribution.md | 95 ++++++++++++++++++ 2 files changed, 95 insertions(+), 97 deletions(-) delete mode 100644 sources/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md create mode 100644 translated/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md diff --git a/sources/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md b/sources/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md deleted file mode 100644 index 903c8418e1..0000000000 --- a/sources/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md +++ /dev/null @@ -1,97 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution) -[#]: via: (https://itsfoss.com/appcenter-for-everyone/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution -====== - -_**Brief: elementary OS is building an app center ecosystem where you can buy open source applications for your Linux distribution.**_ - -### Crowdfunding to build an open source AppCenter for everyone - -![][1] - -[elementary OS][2] recently announced that it is [crowdfunding a campaign to build an app center][3] from where you can buy open source applications. The applications in the app center will be in Flatpak format. - -Though it’s an initiative taken by elementary OS, this new app center will be available for other distributions as well. - -The campaign aims to fund a week of in-person development sprint in Denver, Colorado (USA) featuring developers from elementary OS, [Endless][4], [Flathub][5] and [GNOME][6]. - -The crowdfunding campaign has already crossed its goal of raising $10,000. You can still fund it as additional funds will be used for the development of elementary OS. - -[Crowdfunding Campaign][3] - -### What features this AppCenter brings - -The focus is on providing ‘secure’ applications and hence [Flatpak][7] apps are used to provide confined applications. In this format, apps will be restricted from accessing system or personal files and will be isolated from other apps on a technical level by default. - -Apps will have access to operating system and personal files only if you explicitly provide your consent for it. - -Apart from security, [Flatpak][8] also bundles all the dependencies. This way, app developers can utilize the cutting edge technologies even if it is not available on the current Linux distribution. - -AppCenter will also have the wallet feature to save your card details. This enables you to quickly pay for apps without entering the card details each time. - -![][9] - -This new open source ‘app center’ will be available for other Linux distributions as well. - -### Inspired by the success of elementary OS’s own ‘Pay What You Want’ app center model - -A couple of years ago, elementary OS launched its own app center. The ‘pay what you want’ approach for the app center was quite a hit. The developers can put a minimum amount for their open source apps and the users can choose to pay an amount equal to or more than the minimum amount. - -![][10] - -This helped several indie developers get paid for their open source applications. The app store now has around 160 native applications and elementary OS says that thousands of dollars have been paid to the developers through the app center. - -Inspired by the success of this app center experiment in elementary OS, they now want to bring this app center approach to other distributions as well. - -### If the applications are open source, how can you charge money for it? - -Some people still get confused with the idea of FOSS (free and open source). Here, the **source** code of the software is **open** and anyone is **free** to modify it and redistribute it. - -It doesn’t mean that open source software has to be free of cost. Some developers rely on donations while some charge a fee for support. - -Getting paid for the open source apps may encourage developers to create [applications for Linux][11]. - -### Let’s see if it could work - -![][12] - -Personally, I am not a huge fan of Flatpak or Snap packaging format. They do have their benefits but they take relatively more time to start and they are huge in size. If you install several such Snaps or Flatpaks, your disk space may start running out of free space. - -There is also a need to be vigilant about the fake and scam developers in this new app ecosystem. Imagine if some scammers starts creating Flatpak package of obscure open source applications and put it on the app center? I hope the developers put some sort of mechanism to weed out such apps. - -I do hope that this new AppCenter replicates the success it has seen in elementary OS. We definitely need a better ecosystem for open source apps for desktop Linux. - -What are your views on it? Is it the right approach? What suggestions do you have for the improvement of the AppCenter? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/appcenter-for-everyone/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/appcenter.png?ssl=1 -[2]: https://elementary.io/ -[3]: https://www.indiegogo.com/projects/appcenter-for-everyone/ -[4]: https://itsfoss.com/endless-linux-computers/ -[5]: https://flathub.org/ -[6]: https://www.gnome.org/ -[7]: https://flatpak.org/ -[8]: https://itsfoss.com/flatpak-guide/ -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/appcenter-wallet.png?ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/appcenter-payment.png?ssl=1 -[11]: https://itsfoss.com/essential-linux-applications/ -[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/open_source_app_center.png?ssl=1 diff --git a/translated/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md b/translated/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md new file mode 100644 index 0000000000..fdc7ac1132 --- /dev/null +++ b/translated/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution) +[#]: via: (https://itsfoss.com/appcenter-for-everyone/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +elementary OS 正在构建一个可以买应用的开源应用商店 +====== + +> elementary OS 正在构建一个应用中心生态系统,你可以在其中购买用于 Linux 发行版的开源应用程序。 + +### 众筹构建一个开源应用中心 + +![][1] + +[elementary OS][2] 最近宣布,它正在[众筹举办一个构建应用中心的活动][3],你可以从这个应用中心购买开源应用程序。应用中心中的应用程序将为 Flatpak 格式。 + +尽管这是 elementary OS 发起的活动,但这个新的应用中心也将适用于其他发行版。 + +该活动旨在资助在美国科罗拉多州丹佛市进行的一项一周个人开发冲刺活动,其中包括来自 elementary OS、[Endless][4]、[Flathub][5] 和 [GNOME][6] 的开发人员。 + +众筹活动已经超过了筹集 1 万美元的目标(LCTT 译注:截止至本译文发布,已近 15000 美金)。但你仍然可以为其提供资金,因为其他资金将用于开发 elementary OS。 + +### 这个应用中心将带来什么功能 + +其重点是提供“安全”应用程序,因此使用 [Flatpak][7] 应用来提供受限的应用程序。在这种格式下,默认情况下将会限制应用程序访问系统或个人文件,并在技术层面上将它们与其他应用程序隔离。 + +仅当你明确表示同意时,应用程序才能访问操作系统和个人文件。 + +除了安全性,[Flatpak][8] 还捆绑了所有依赖项。这样,即使当前 Linux 发行版中不提供这些依赖项,应用程序开发人员也可以利用这种最先进的技术使用它。 + +AppCenter 还具有钱包功能,可以保存你的信用卡详细信息。这样,你无需每次输入卡的详细信息即可快速为应用付费。 + +![][9] + +这个新的开源“应用中心”也将适用于其他 Linux 发行版。 + +### 受到了 elementary OS 自己的“按需付费”应用中心模型成功的启发 + +几年前,elementary OS 推出了自己的应用中心。应用中心的“按需付费”方法很受欢迎。开发人员可以为其开源应用设置最低金额,而用户可以选择支付等于或高于最低金额的金额。 + +![][10] + +这帮助了几位独立开发人员可以对其开源应用程序接受付款。该应用中心现在拥有约 160 个原生应用程序,elementary OS 表示已通过应用中心向开发人员支付了数千美元。 + +受到此应用中心实验在 elementary OS 中的成功的启发,他们现在也希望将此应用中心的方法也引入其他发行版。 + +### 如果应用程序是开源的,你怎么为此付费? + +某些人仍然对 FOSS(自由而开源)的概念感到困惑。在这里,该软件的“源代码”是“开源的”,任何人都可以“自由”进行修改和重新分发。 + +但这并不意味着开源软件必须免费。一些开发者依靠捐赠,而另一些则收取支持费用。 + +获得开源应用程序的报酬可能会鼓励开发人员创建 [Linux 应用程序][11]。 + +### 让我们拭目以待 + +![][12] + +就个人而言,我不是 Flatpak 或 Snap 包格式的忠实拥护者。它们确实有其优点,但是它们花费了相对更多的时间来启动,并且它们的包大小很大。如果安装了多个此类 Snap 或 Flatpak 软件包,磁盘空间就会慢慢耗尽。 + +也需要对这个新的应用程序生态系统中的假冒和欺诈开发者保持警惕。想象一下,如果某些骗子开始创建冷门的开源应用程序的 Flatpak 程序包,并将其放在应用中心上?我希望开发人员采用某种机制来淘汰此类应用程序。 + +我确实希望这个新的应用中心能够复制在 elementary OS 中已经看到的成功。对于桌面 Linux 的开源应用程序,我们绝对需要更好的生态系统。 + +你对此有何看法?这是正确的方法吗?你对改进应用中心有什么建议? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/appcenter-for-everyone/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/appcenter.png?ssl=1 +[2]: https://elementary.io/ +[3]: https://www.indiegogo.com/projects/appcenter-for-everyone/ +[4]: https://itsfoss.com/endless-linux-computers/ +[5]: https://flathub.org/ +[6]: https://www.gnome.org/ +[7]: https://flatpak.org/ +[8]: https://itsfoss.com/flatpak-guide/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/appcenter-wallet.png?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/appcenter-payment.png?ssl=1 +[11]: https://itsfoss.com/essential-linux-applications/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/open_source_app_center.png?ssl=1 From 09fe9739520ea6a08cd58836c64e61b33c4dfa29 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 28 Feb 2020 00:10:43 +0800 Subject: [PATCH 118/260] PUB @wxy https://linux.cn/article-11939-1.html --- ...ou Can Buy Open Source Apps for Your Linux Distribution.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md (98%) diff --git a/translated/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md b/published/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md similarity index 98% rename from translated/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md rename to published/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md index fdc7ac1132..6619254799 100644 --- a/translated/tech/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md +++ b/published/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11939-1.html) [#]: subject: (elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution) [#]: via: (https://itsfoss.com/appcenter-for-everyone/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From a1cd1e2f36a35ef899bdd050ef406d6005bb6803 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 28 Feb 2020 01:02:06 +0800 Subject: [PATCH 119/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200226=20Mirant?= =?UTF-8?q?is:=20Balancing=20Open=20Source=20with=20Guardrails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200226 Mirantis- Balancing Open Source with Guardrails.md --- ...- Balancing Open Source with Guardrails.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20200226 Mirantis- Balancing Open Source with Guardrails.md diff --git a/sources/tech/20200226 Mirantis- Balancing Open Source with Guardrails.md b/sources/tech/20200226 Mirantis- Balancing Open Source with Guardrails.md new file mode 100644 index 0000000000..5eeb400060 --- /dev/null +++ b/sources/tech/20200226 Mirantis- Balancing Open Source with Guardrails.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Mirantis: Balancing Open Source with Guardrails) +[#]: via: (https://www.linux.com/articles/mirantis-balancing-open-source-with-guardrails/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Mirantis: Balancing Open Source with Guardrails +====== + +[![][1]][2] + +[![][1]][2] + +Mirantis, an open infrastructure company that rose to popularity with its OpenStack offering, is now moving into the Kubernetes space very aggressively. [Last year, the company acquired the Docker Enterprise business from Docker.][3] [This week, it announced that they were hiring the Kubernetes experts from the Finnish company Kontena a][4]nd established a Mirantis office in Finland, expanding the company’s footprint in Europe. Mirantis already has a significant presence in Europe due to large customers such as Bosch and [Volkswagen][5]. + +The Kontena team primarily focused on two technologies. One was a Kubernetes distro called [Pharos][6], which differentiated itself from other distributions by specializing in addressing life cycle management challenges. They had developed some unique capabilities for deployment and for updating Kubernetes itself. + +The second product by Kontena is [Lens][6]. “It’s like a Kubernetes dashboard on steroids. In addition to offering the standard dashboard functions, it went multiple steps further by providing a terminal for command line interfacing to nodes and containers, and additional real-time insights, role-based access controls and a number of other capabilities that are currently absent from the Kubernetes dashboard,” said [Dave Van Everen][7], SVP of Marketing at Mirantis. + +Everything that Kontena does is open source. These open source projects are already used by hundreds of organizations around the world. “They have a proven track record of contributing valuable technology pieces to the Kubernetes ecosystem, and we saw an opportunity to bring the team on board and capitalized on that opportunity as quickly as we could,” said Van Everen. + +Mirantis will integrate many of the technology concepts and benefits from Pharos into its Docker Enterprise offering. With Kontena engineers on board, Mirantis expects to incorporate the best of what Kontena offered into its commercially supported Docker Enterprise and [Kubernetes][8] technology. + +With this acquisition, Mirantis has hinted at a very aggressive 2020. The company is weeks away from launching the first Docker Enterprise release since the acquisition. The release brings many new capabilities on top of Docker Enterprise 3.0. The company is working on merging the [Mirantis KaaS][9] capabilities with Docker Enterprise. “We will add new capabilities, including multi-cluster management and continuous automated updates to the Kubernetes that’s already within Docker Enterprise,” said Van Everen. + +**What is Mirantis today?** + +Mirantis started out as a pure-play OpenStack company, but as the market dynamics changed, the company adjusted its own positioning and bet on CD platforms like Spinnaker and container orchestration technologies like Kubernetes. So, what are they focusing on today? + +Van Everen said that Mirantis is definitely embracing Kubernetes as the open standard used by enterprises for modern applications. Kubernetes itself has a massive ecosystem of technologies that a customer needs to leverage. “When we speak about Kubernetes, we speak about full-stack Kubernetes, which includes that ecosystem consisting of a couple dozen components in a typical cluster deployment. Our job as a trusted partner in helping our customers accelerate their path to modern applications is to streamline and automate all of the infrastructure and DevOps tooling supporting their app development lifecycle,” san Van Everen. + +In a nutshell, Mirantis is making it easier for customers to use Kubernetes. + +Over the years, [Mirantis][10] has gained expertise in IaaS with the work they did on OpenStack. “All of that plays a role in helping companies move faster and become more agile as they’re modernizing their applications. We apply many of those same strengths to the Kubernetes ecosystem,” he said. + +Mirantis is also building expertise in continuous delivery platforms like [Argo CD][11] and is offering customers a spectrum of professional services around application modernization, from writing code that is based in microservices architecture, to integrating CI/CD pipelines and modernizing the tooling for CI/CD to better support cloud-native patterns. By supporting Kubernetes technology with app modernization services, Mirantis is helping customers wherever they are in their digital transformation and cloud-native journey. + +“All of those things that our services team provides are complementary to the technology. That’s a unique value that only Mirantis can provide to the market, where we can couple open source technologies with strong services to ensure that companies really get the most out of that open source technology and fulfill their ultimate goal, which is to accelerate their pace of innovation,” Van Everen said. + +Container networking is a critical piece of the cloud-native world and Mirantis already has expertise in the area, thanks to their work on OpenStack. The company recently joined the Linux Foundation’s [LF Networking project][12] which is home to [Tungsten Fabric][13] (formerly known as OpenContrail), a technology that Mirantis uses for its [OpenStack][14] offerings. + +He explains, “While we use Calico for the container networking, Tungsten Fabric would be an important part of the underlying networking supporting Kubernetes deployments. Staying true to our heritage, we want to be involved in the open community and have both a voice and a stake in the direction the communities are moving in.” + +[As for the ongoing debate or controversy around two competing service mesh technologies Istio and Linkerd,][15] the company has made its bet on Istio. A few months ago, Mirantis announced a training program for Istio, which was bundled with Mirantis’ KaaS offerings. + +“We include Istio as a service mesh by default in child clusters under Mirantis KaaS management. It’ll be used as an ingress with Docker Enterprise initially. Moving forward, we’re still looking at how to best deploy it in a service mesh configuration by default and provide a configurable but still functional default deployment for Istio as a service mesh,” said Van Everen. + +It might seem like Mirantis is latching on to the latest hot technologies like OpenStack, [Spinnaker][16], Docker Enterprise, Kubernetes, and Istio to see what sticks. In reality, there is a method to it: the company is going where its customers are going, with the technologies that customers are using. It’s a fine balancing act. + +“That’s the type of technology challenge that Mirantis embraces. We are open source experts and continue to provide the greatest flexibility and choice in our industry, but we do it in such a way that there are guardrails in place so that companies don’t end up having something that’s overly complex and unmanageable, or configured incorrectly,” he concluded. + +Note: Cross posted to [TFIR][17] + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/mirantis-balancing-open-source-with-guardrails/ + +作者:[Swapnil Bhartiya][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/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2019/09/world-network-1068x713.jpg (world-network) +[2]: https://www.linux.com/wp-content/uploads/2019/09/world-network.jpg +[3]: https://www.youtube.com/watch?v=cBOrVKuomcU&feature=emb_title +[4]: https://containerjournal.com/topics/container-ecosystems/mirantis-acquires-kubernetes-assets-from-kontena/ +[5]: https://www.mirantis.com/company/press-center/company-news/volkswagen-group-selects-mirantis-openstack-software-next-generation-cloud/ +[6]: https://github.com/kontena +[7]: https://twitter.com/davidvaneveren?lang=en +[8]: https://kubernetes.io/ +[9]: https://www.tfir.io/mirantis-launches-kaas-across-bare-metal-public-and-private-clouds/ +[10]: https://www.mirantis.com/ +[11]: https://argoproj.github.io/argo-cd/ +[12]: https://www.linuxfoundation.org/projects/networking/ +[13]: https://tungsten.io/ +[14]: https://www.openstack.org/ +[15]: https://twitter.com/hashtag/istio?lang=en +[16]: https://www.tfir.io/?s=spinnaker +[17]: https://www.tfir.io/mirantis-balancing-open-source-with-guardrails/ From 5fd81991eeac517453619507dbff21bd3cb485ff Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 28 Feb 2020 01:03:07 +0800 Subject: [PATCH 120/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200228=20No=20M?= =?UTF-8?q?ore=20WhatsApp!=20The=20EU=20Commission=20Switches=20To=20?= =?UTF-8?q?=E2=80=98Signal=E2=80=99=20For=20Internal=20Communication?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md --- ... To ‘Signal- For Internal Communication.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md diff --git a/sources/tech/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md b/sources/tech/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md new file mode 100644 index 0000000000..8b47602a54 --- /dev/null +++ b/sources/tech/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (No More WhatsApp! The EU Commission Switches To ‘Signal’ For Internal Communication) +[#]: via: (https://itsfoss.com/eu-commission-switches-to-signal/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +No More WhatsApp! The EU Commission Switches To ‘Signal’ For Internal Communication +====== + +_**In a move to improve the cyber-security, EU has recommended its staff to use open source secure messaging app Signal instead of the popular apps like WhatsApp.**_ + +[Signal is an open source secure messaging application][1] with end to end encryption. It is praised by the likes of [Edward Snowden][2] and other privacy activists, journalists and researchers. We’ve recently covered it in our ‘[open source app of the week][3]‘ series. + +[Signal][4] is in news for good reasons. The European Union Commissions have instructed its staff to use Signal for public instant messaging. + +This is part of EU”s new cybersecurity strategy. There has been cases of data leaks and hacking against EU diplomats and thus policy is being put in place to encourage better security practices. + +### Governments recommending open source technology is a good sign + +![][5] + +No matter what the reason is, Government bodies recommending open-source services for better security is definitely a good thing for the open-source community in general. + +[Politico][6] originally reported this by mentioning that the EU instructed its staff to use Signal as the recommended public instant messaging app: + +> The instruction appeared on internal messaging boards in early February, notifying employees that “Signal has been selected as the recommended application for public instant messaging.” + +The report also mentioned the potential advantage of Signal (which is why the EU is considering using it): + +> “It’s like Facebook’s WhatsApp and Apple’s iMessage but it’s based on an encryption protocol that’s very innovative,” said Bart Preneel, cryptography expert at the University of Leuven. “Because it’s open-source, you can check what’s happening under the hood,” he added. + +Even though they just want to secure their communication or want to prevent high-profile leaks, switching to an open-source solution instead of [WhatsApp][7] sounds good to me. + +### Signal gets a deserving promotion + +Even though Signal is a centralized solution that requires a phone number as of now, it is still a no-nonsense open-source messaging app that you may trust. + +Privacy enthusiasts already know a lot of services (or alternatives) to keep up with the latest security and privacy threats. However, with the EU Commission recommending it to its staff, Signal will get an indirect promotion for common mobile and desktop users. + +### Wrapping Up + +It is still an irony that some Government bodies hate encrypted solutions while opting to use them for their own requirement. + +Nevertheless, it is good progress for open-source services and tech, in general, is recommended as a secure alternative. + +What do you think about the EU’s decision on switching to the Signal app for its internal communication? Feel free to let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/eu-commission-switches-to-signal/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/signal-messaging-app/ +[2]: https://en.wikipedia.org/wiki/Edward_Snowden +[3]: https://itsfoss.com/tag/app-of-the-week/ +[4]: https://www.signal.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/Signal-eu.jpg?ssl=1 +[6]: https://www.politico.eu/pro/eu-commission-to-staff-switch-to-signal-messaging-app/ +[7]: https://www.whatsapp.com/ From df37dc49cd4f83d1bab0ea689ddf4556a61549ee Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 28 Feb 2020 01:07:15 +0800 Subject: [PATCH 121/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200226=20Use=20?= =?UTF-8?q?logzero=20for=20simple=20logging=20in=20Python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200226 Use logzero for simple logging in Python.md --- ...se logzero for simple logging in Python.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 sources/tech/20200226 Use logzero for simple logging in Python.md diff --git a/sources/tech/20200226 Use logzero for simple logging in Python.md b/sources/tech/20200226 Use logzero for simple logging in Python.md new file mode 100644 index 0000000000..1fbd61b68f --- /dev/null +++ b/sources/tech/20200226 Use logzero for simple logging in Python.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use logzero for simple logging in Python) +[#]: via: (https://opensource.com/article/20/2/logzero-python) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +Use logzero for simple logging in Python +====== +A quick primer on the handy log library that can help you master this +important programming concept. +![Snake charmer cartoon with a yellow snake and a blue snake][1] + +The logzero library makes logging as easy as a print statement, which is quite a feat of simplicity. I'm not sure whether logzero took its name to fit in with the series of "zero boilerplate" libraries like pygame-zero, GPIO Zero, and guizero, but it's certainly in that category. It's a Python library that makes logging straightforward. + +You can just use its basic logging to stdout the same way you might use print for information and debugging purposes, and it has a smooth learning curve towards more advanced logging, like logging to a file. + +To start, install logzero with pip: + + +``` +`$ sudo pip3 install logzero` +``` + +Now in a Python file, import logger and try one or all of these logging examples: + + +``` +from logzero import logger + +logger.debug("hello") +logger.info("info") +logger.warning("warning") +logger.error("error") +``` + +The output is automatically colored in an easy-to-read way: + +![Python, Raspberry Pi: import logger][2] + +So now, instead of using **print** to figure out what's going on, use logger instead, with the relevant log level. + +### Writing logs to a file in Python + +If you only read this far and make that one change in the way you write code, that's good enough for me. If you want to go further, read on! + +Writing to **stdout** is fun for testing a new program, but it is only useful if you are logged into the computer where the script is running. Many times when using an application you'll want to execute the code remotely and review errors after the fact. That's when it's helpful to log to a file instead. Let's try it: + + +``` +from logzero import logger, logfile + +logfile('/home/pi/test.log') +``` + +Now your log entries will be logged into the file **test.log**. Remember to make sure that the [script has permission][3] to write to that file and its directory structure. + +You can specify some more options too: + + +``` +`logfile(’/home/pi/test.log’, maxBytes=1e6, backupCount=3)` +``` + +Now when the file provided to **logfile** reaches 1MB (1×106 bytes), it will rotate entries through **test.log.1**, **test.log.2**, and so on. This behavior is nice to avoid generating a massive log file that is I/O intensive for the system to open and close. You might also want to log to **/var/log** like a pro. Assuming you're on Linux, you a directory and make your user the owner so they can write to it: + + +``` +$ sudo mkdir /var/log/test +$ sudo chown pi /var/log/test +``` + +Then in your Python code, change the **logfile** path: + + +``` +`logfile(’/var/log/test/test.log’, maxBytes=1e6, backupCount=3)` +``` + +When it comes to catching exceptions in your **logfile**, you can either use **logging.exception:** + + +``` +try: +    c = a / b +except Exception as e: +    logger.exception(e) +``` + +This will produce the following (in the case that b is zero): + + +``` +[E 190422 23:41:59 test:9] division by zero +     Traceback (most recent call last): +       File "test.py", line 7, in +         c = a / b +     ZeroDivisionError: division by zero +``` + +You get the log entry, followed by the full traceback. Alternatively, you could use **logging.error** and hide the traceback: + + +``` +try: +    c = a / b +except Exception as e: +    logger.error(f"{e.__class__.__name__}: {e}") +``` + +Now this will produce the more succinct: + + +``` +`[E 190423 00:04:16 test:9] ZeroDivisionError: division by zero` +``` + +* * * + +* * * + +* * * + +**![Logging output][4]** + +There are plenty more options which you can read in the docs at [logzero.readthedocs.io][5]. + +### logzero shines for education + +Logging can be a challenging concept for a new programmer. Most frameworks depend on flow control and lots of variable manipulation to make a meaningful log, but logzero is different. With its syntax being similar to a print statement, it is a big win for education as it saves from explaining another concept. Give it a try on your next project. + +\-- + +_This article was originally written on [my blog][6] and is republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/logzero-python + +作者:[Ben Nuttall][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/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake) +[2]: https://opensource.com/sites/default/files/uploads/rpi_ben_1.png (Python, Raspberry Pi: import logger) +[3]: https://opensource.com/article/19/6/understanding-linux-permissions +[4]: https://opensource.com/sites/default/files/uploads/rpi_ben_2.png (Logging output) +[5]: https://logzero.readthedocs.io/en/latest/ +[6]: https://tooling.bennuttall.com/logzero/ From e811f79f7b1831f2290a37cf9f56a1e3144e3865 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 28 Feb 2020 08:28:12 +0800 Subject: [PATCH 122/260] translated --- ...hing- Open Source P2P File Syncing Tool.md | 146 ------------------ ...hing- Open Source P2P File Syncing Tool.md | 146 ++++++++++++++++++ 2 files changed, 146 insertions(+), 146 deletions(-) delete mode 100644 sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md create mode 100644 translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md diff --git a/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md b/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md deleted file mode 100644 index fe48819ada..0000000000 --- a/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md +++ /dev/null @@ -1,146 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Syncthing: Open Source P2P File Syncing Tool) -[#]: via: (https://itsfoss.com/syncthing/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Syncthing: Open Source P2P File Syncing Tool -====== - -_**Brief: Syncthing is an open-source peer-to-peer file synchronization tool that you can use for syncing files between multiple devices (including an Android phone).**_ - -Usually, we have a cloud sync solution like [MEGA][1] or Dropbox to have a backup of our files on the cloud while making it easier to share it. - -But, what do you do if you want to sync your files across multiple devices without storing them on the cloud? - -That is where [Syncthing][2] comes to the rescue. - -### Syncthing: An open source tool to synchronize files across devices - -![][3] - -Syncthing lets you sync your files across multiple devices (including the support for Android smartphones). It primarily works through a web UI on Linux but also offers a GUI (to separately install). - -However, Syncthing does not utilize the cloud at all – it is a [peer-to-peer][4] file synchronization tool. Your data doesn’t go to a central server. Instead, the data is synced with all the devices between them. So, it does not really replace the [typical cloud storage services on Linux][5]. - -To add remote devices, you just need the device ID (or simply scan the QR code), no IP addresses involved. - -If you want a remote backup of your files – you should probably rely on the cloud. - -![Syncthing GUI][6] - -All things considered, Syncthing can come in handy for a lot of things. Technically, you can have your important files accessible on multiple systems securely and privately without worrying about anyone spying on your data. - -For instance, you may not want to store some of the sensitive files on the cloud – so you can add other trusted devices to sync and keep a copy of those files. - -Even though I described it briefly, there’s more to it and than meets the eye. I’d also recommend reading the [official FAQ][7] to clear some confusion on how it works – if you’re interested. - -### Features of Syncthing - -You probably do not want a lot of options in a synchronization tool – it should be dead simple to work reliably to sync your files. - -Syncthing is indeed quite simple and easy to understand – even though it is recommended that you should go through the [documentation][8] if you want to use every bit of its functionality. - -Here, I’ll highlight a few useful features of Syncthing: - -#### Cross-Platform Support - -![Syncthing on Android][9] - -Being an open-source solution, it does support Windows, Linux, and macOS. - -In addition to that, it also supports Android smartphones. You’ll be disappointed if you have an iOS device – so far, no plans for iOS support. - -#### File Versioning - -![Syncthing File Versioning][10] - -Syncthing utilizes a variety of [File Versioning methods][11] to archive the old files if they are replaced or deleted. - -By default, you won’t find it enabled. But, when you create a folder to sync, that’s when you will find the option to toggle the file versioning to your preferred method. - -#### Easy To Use - -While being a peer-to-peer file synchronization tool, it just works out of the box with no advanced tweaks. - -However, it does let you configure advanced settings when needed. - -#### Security & Privacy - -Even though you do not share your data with any cloud service providers, there are still some connections made that might gain the attention of an eavesdropper. So, Syncthing makes sure the communication is secured using TLS. - -In addition to that, there are solid authentication methods to ensure that only the devices/connections you allow explicitly will be granted access to sync/read data. - -For Android smartphones, you can also force the traffic through Tor if you’re using the [Orbot app][12]. You’ll find several other options for Android as well. - -#### Other Functionalities - -![][13] - -When exploring the tool yourself, you will notice that there are no limits to how many folders you can sync and the number of devices that you can sync. - -So, being a free and open-source solution with lots of useful features makes it an impressive choice for Linux users looking to have a peer-to-peer sync client. - -### Installing Syncthing on Linux - -You may not observe a .deb file or an .AppImage file for it on its official download webpage. But, you do get a snap package on the [Snap store][14] – if you’re curious you can read about [using snap apps][15] on Linux to get started. - -You may not find it in the software center (if you do – it may not be the latest version). - -**Note:** _There’s also a [Syncthing-GTK][16] available if you want a GUI to manage that – instead of a browser._ - -[Syncthing][2] - -You can also utilize the terminal to get it installed if you have a Debian-based distro – the instructions are on the [official download page][17]. - -### My experience with Syncthing - -Personally, I got it installed on Pop!_OS 19.10 and used it for a while before writing this up. - -I tried syncing folders, removing them, adding duplicate files to see how the file versioning works, and so on. It worked just fine. - -However, when I tried syncing it to a phone (Android) – the sync started a bit late, it wasn’t very quick. So, if we could have an option to explicitly force sync, that could help. Or, did I miss the option? Let me know in the comments if I did. - -Technically, it uses the resources of your system to work – so if you have a number of devices connected to sync, it should potentially improve the sync speed (upload/download). - -Overall, it works quite well – but I must say that you shouldn’t rely on it as the only backup solution to your data. - -**Wrapping Up** - -Have you tried Syncthing yet? If yes, how was your experience with it? Feel free to share it in the comments below. - -Also, if you know about some awesome alternatives to this – let me know about it as well. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/syncthing/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/install-mega-cloud-storage-linux/ -[2]: https://syncthing.net/ -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot.jpg?ssl=1 -[4]: https://en.wikipedia.org/wiki/Peer-to-peer -[5]: https://itsfoss.com/cloud-services-linux/ -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-gtk.png?ssl=1 -[7]: https://docs.syncthing.net/users/faq.html -[8]: https://docs.syncthing.net/users/index.html -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-android.jpg?ssl=1 -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-file-versioning.jpg?ssl=1 -[11]: https://docs.syncthing.net/users/versioning.html -[12]: https://play.google.com/store/apps/details?id=org.torproject.android&hl=en_IN -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot1.jpg?ssl=1 -[14]: https://snapcraft.io/syncthing -[15]: https://itsfoss.com/install-snap-linux/ -[16]: https://github.com/syncthing/syncthing-gtk/releases/latest -[17]: https://syncthing.net/downloads/ diff --git a/translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md b/translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md new file mode 100644 index 0000000000..013a3569a4 --- /dev/null +++ b/translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Syncthing: Open Source P2P File Syncing Tool) +[#]: via: (https://itsfoss.com/syncthing/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Syncthing:开源 P2P 文件同步工具 +====== + +_ **简介:Syncthing 是一个开源的 P2P 文件同步工具,可用于在多个设备(包括 Android 手机)之间同步文件。** _ + +通常,我们有 [MEGA][1] 或 Dropbox 之类的云同步解决方案,以便在云上备份我们的文件,同时更易于共享。 + +但是,如果要跨多个设备同步文件而不将其存储在云中怎么办? + +这就是 [Syncthing][2] 派上用场的地方了。 + +### Syncthing:一个跨设备同步文件的开源工具 + +![][3] + +Syncthing 可让你跨多个设备同步文件(包括对 Android 智能手机的支持)。它主要通过 Linux上 的 Web UI 进行工作,但也提供了 GUI(需要单独安装)。 + +然而,Syncthing 完全没有利用云,它是 [P2P][4] 文件同步工具。你的数据不会被发送到中央服务器。而是会在所有设备之间同步。因此,它并不能真正取代 [Linux 上的典型云存储服务][5]。 + +要添加远程设备,你只需要设备 ID(或直接扫描二维码),而无需 IP 地址。 + +如果你想要远程备份文件,那么你可能应该依靠云。 + +![Syncthing GUI][6] + +考虑到所有因素,Syncthing 可以在很多方面派上用场。从技术上讲,你可以安全、私密地在多个系统上访问重要文件,而不必担心有人监视你的数据。 + +例如,你可能不想在云上存储一些敏感文件,因此你可以添加其他受信任的设备来同步并保留这些文件的副本。 + +即使我简单描述了它,但它并不像看到的那么简单。如果你感兴趣的话,我建议你阅读[官方 FAQ][7] 来了解它如何工作的。 + +### Syncthing 的特性 + +你可能不希望同步工具中有很多选项。它要可靠地同步文件,应该非常简单。 + +Syncthing 确实非常简单且易于理解。即使这样,如果你想使用它的所有功能,那么也建议你阅读它的[文档][8]。 + +在这里,我将重点介绍 Syncthing 的一些有用特性: + +#### 跨平台支持 + +![Syncthing on Android][9] + +作为开源解决方案,它支持 Windows、Linux 和 macOS。 + +除此之外,它还支持 Android 智能手机。如果你使用的是 iOS 设备,那么你会感到失望。到目前为止,它还没有支持 iOS 的计划。 + +#### 文件版本控制 + +![Syncthing File Versioning][10] + +如果替换或删除了旧文件,那么 Syncthing 会利用各种[文件版本控制方法][11]来存档旧文件。 + +默认情况下,你不会发现它启用。但是,当你创建一个要同步的文件夹时,你将找到将文件版本控制切换为首选方法的选项。 + +#### 易于使用 + +作为 P2P 文件同步工具,它无需高级调整即可使用。 + +但是,它允许你在需要时配置高级设置。 + +#### 安全和隐私 + +即使你不与任何云服务提供商共享数据,仍会有一些连接可能会引起窃听者的注意。因此,Syncthing 使用 TLS 保护通信。 + +此外,它还有可靠的身份验证方法,以确保仅授予只有你允许的设备/连接能够取得同步/读取数据的权限。 + +对于 Android 智能手机,如果你使用 [Orbot 应用][12],你还可以强制将流量通过 Tor。在 Android 中你还有几个不同选择。 + +#### 其他功能 + +![][13] + +当你探索这个工具时,你会注意到可以同步的文件夹数和可同步的设备数没有限制。 + +因此,作为一个有着丰富有用特性的自由开源解决方案,对于在寻找 P2P 同步客户端的 Linux 用户而言是一个令人印象深刻的选择。 + +### 在 Linux 上安装 Syncthing + +你可能无法在官网上找到 .deb 或者 .AppImage 文件。但是,你可在 [Snap 商店][14]中找到 snap 包。如果你好奇,你可以阅读在 Linux 上[使用 snap 应用][15]的文章来开始使用。 + +你可能无法在软件中心找到它(如果你找到了,那它可能不是最新版本)。 + +**注意:**_如果你需要一个 GUI 而不是浏览器来管理它,它还有一个 [Syncthing-GTK][16]。_ + +[Syncthing][2] + +如果你有基于 Debian 的发行版,你也可以利用终端来安装它,这些说明位于[官方下载页面][17] 上。 + +### 我在 Syncthing 方面的体验 + +就个人而言,我把它安装在 Pop!\_OS 19.10 上,并在写这篇文章之前用了一会儿。 + +我尝试同步文件夹、删除它们、添加重复文件以查看文件版本控制是否工作,等等。它工作良好。 + +然而,当我尝试同步它到手机(安卓),同步启动有点晚,它不是很快。因此,如果我们可以选择显式强制同步,那会有所帮助。或者,我错过了什么选项吗?如果是的话,请在评论中让我知道。 + +从技术上讲,它使用系统资源来工作,因此,如果你连接了多个设备进行同步,这可能会提高同步速度(上传/下载)。 + +总体而言,它工作良好,但我必须说,你不应该依赖它作为唯一的数据备份方案。 + +**总结** + +你试过 Syncthing 了吗?如果有的话,你的体验如何?欢迎在下面的评论中分享。 + +此外,如果你知道一些不错的替代品,也请让我知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/syncthing/ + +作者:[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://itsfoss.com/install-mega-cloud-storage-linux/ +[2]: https://syncthing.net/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot.jpg?ssl=1 +[4]: https://en.wikipedia.org/wiki/Peer-to-peer +[5]: https://itsfoss.com/cloud-services-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-gtk.png?ssl=1 +[7]: https://docs.syncthing.net/users/faq.html +[8]: https://docs.syncthing.net/users/index.html +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-android.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-file-versioning.jpg?ssl=1 +[11]: https://docs.syncthing.net/users/versioning.html +[12]: https://play.google.com/store/apps/details?id=org.torproject.android&hl=en_IN +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot1.jpg?ssl=1 +[14]: https://snapcraft.io/syncthing +[15]: https://itsfoss.com/install-snap-linux/ +[16]: https://github.com/syncthing/syncthing-gtk/releases/latest +[17]: https://syncthing.net/downloads/ From ac5171ccda017e545b5c0895bd654127657efdcb Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 28 Feb 2020 08:32:28 +0800 Subject: [PATCH 123/260] translating --- sources/tech/20200214 PHP Development on Fedora with Eclipse.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200214 PHP Development on Fedora with Eclipse.md b/sources/tech/20200214 PHP Development on Fedora with Eclipse.md index a682381686..24ecdcb232 100644 --- a/sources/tech/20200214 PHP Development on Fedora with Eclipse.md +++ b/sources/tech/20200214 PHP Development on Fedora with Eclipse.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c97e47b5c0b4cb7789082f1acdf7c024445dd8fe Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 28 Feb 2020 09:25:49 +0800 Subject: [PATCH 124/260] Rename sources/tech/20200226 Mirantis- Balancing Open Source with Guardrails.md to sources/talk/20200226 Mirantis- Balancing Open Source with Guardrails.md --- .../20200226 Mirantis- Balancing Open Source with Guardrails.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200226 Mirantis- Balancing Open Source with Guardrails.md (100%) diff --git a/sources/tech/20200226 Mirantis- Balancing Open Source with Guardrails.md b/sources/talk/20200226 Mirantis- Balancing Open Source with Guardrails.md similarity index 100% rename from sources/tech/20200226 Mirantis- Balancing Open Source with Guardrails.md rename to sources/talk/20200226 Mirantis- Balancing Open Source with Guardrails.md From 465776f4d618d910e6d4b0783287d484a929b10a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 28 Feb 2020 09:27:18 +0800 Subject: [PATCH 125/260] =?UTF-8?q?Rename=20sources/tech/20200228=20No=20M?= =?UTF-8?q?ore=20WhatsApp-=20The=20EU=20Commission=20Switches=20To=20?= =?UTF-8?q?=E2=80=98Signal-=20For=20Internal=20Communication.md=20to=20sou?= =?UTF-8?q?rces/talk/20200228=20No=20More=20WhatsApp-=20The=20EU=20Commiss?= =?UTF-8?q?ion=20Switches=20To=20=E2=80=98Signal-=20For=20Internal=20Commu?= =?UTF-8?q?nication.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Commission Switches To ‘Signal- For Internal Communication.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md (100%) diff --git a/sources/tech/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md b/sources/talk/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md similarity index 100% rename from sources/tech/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md rename to sources/talk/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md From f05ea42dbb0cda276a889994225f9f3e52698abc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 28 Feb 2020 12:46:57 +0800 Subject: [PATCH 126/260] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lujun9972 这篇不错 --- .../tech/20170918 Fun and Games in Emacs.md | 137 ++++++++---------- 1 file changed, 57 insertions(+), 80 deletions(-) diff --git a/translated/tech/20170918 Fun and Games in Emacs.md b/translated/tech/20170918 Fun and Games in Emacs.md index b4baee63b4..9b547de0de 100644 --- a/translated/tech/20170918 Fun and Games in Emacs.md +++ b/translated/tech/20170918 Fun and Games in Emacs.md @@ -7,106 +7,91 @@ [#]: via: (https://www.masteringemacs.org/article/fun-games-in-emacs) [#]: author: (Mickey Petersen https://www.masteringemacs.org/about) -Emacs 中的游戏与乐趣 +“Emacs 游戏机”完全指南 ====== -又是周一,你正在为你的老板 Lumbergh 努力倒腾那些 [无聊之极的文档 ][1]。为什么不玩玩 Emacs 中类似 zork 的文本冒险游戏来让你的大脑从单调的工作中解脱出来呢? - -但说真的,Emacs 中既有游戏,也有古怪的玩物。有些你可能有所耳闻。这些玩意唯一的共同点就是,它们大多是很久以前就添加到 Emacs 中的:有些东西真的是相当古怪(如您将在下面看到的),而另一些则显然是由无聊的员工或毕业生编写的。 -它们中都带着一种奇思妙想和随意性,这在今天的 Emacs 中很少见。 -Emacs 现在变得十分严肃,在某种程度上,它已经与 20 世纪 80 年代那些玩意被编写出来的时候大不一样。 +又是周一,你正在为你的老板 Lumbergh (LCTT 译注:《上班一条虫》中的副总裁)努力倒腾那些 [无聊之极的文档][1]。为什么不玩玩 Emacs 中类似 zork 的文字冒险游戏来让你的大脑从单调的工作中解脱出来呢? +但说真的,Emacs 中既有游戏,也有古怪的玩物。有些你可能有所耳闻。这些玩意唯一的共同点就是,它们大多是很久以前就添加到 Emacs 中的:有些东西真的是相当古怪(如你将在下面看到的),而另一些则显然是由无聊的员工或学生们编写的。它们全有一个共同点,都带着一种奇思妙想和随意性,这在今天的 Emacs 中很少见。Emacs 现在变得十分严肃,在某种程度上,它已经与 20 世纪 80 年代那些游戏被编写出来的时候大不一样。 ### 汉诺塔 -[汉诺塔 ][2] 是一款古老的数学解密游戏,有些人可能对它很熟悉,因为它的递归和迭代解决方案经常被用与计算机科学教学辅助。 - +[汉诺塔][2] 是一款古老的数学解密游戏,有些人可能对它很熟悉,因为它的递归和迭代解决方案经常被用于计算机科学教学辅助。 ![Tower of Hanoi Screenshot](https://www.masteringemacs.org/static/uploads/hanoi.png) -Emacs 中有三个命令可以运行汉诺塔:`M-x hanoi` 默认为 3 个碟子; `M-x hanoi-unix` 和 `M-x hanoi-unix-64` 使用 unix 时间戳的位数 (32bit 或 64bit) 作为默认盘子的个数,并且每秒钟自动移动一次,两者不同之处在于后者假装使用 64 位时钟(因此有 64 个碟子)。 +Emacs 中有三个命令可以运行汉诺塔:`M-x hanoi` 默认为 3 个碟子; `M-x hanoi-unix` 和 `M-x hanoi-unix-64` 使用 unix 时间戳的位数(32 位或 64 位)作为默认盘子的个数,并且每秒钟自动移动一次,两者不同之处在于后者假装使用 64 位时钟(因此有 64 个碟子)。 -Emacs 中汉诺塔的实现可以追溯到 20 世纪 80 年代中期——确实是久得可怕。它有一些自定义选项 (`M-x customize-group RET hanoi RET`),如启用彩色光盘等。 -当你离开汉诺塔缓冲区或输入一个字符,你会收到一个讽刺的告别信息(见上文)。 +Emacs 中汉诺塔的实现可以追溯到 20 世纪 80 年代中期——确实是久得可怕。它有一些自定义选项(`M-x customize-group RET hanoi RET`),如启用彩色碟子等。当你离开汉诺塔缓冲区或输入一个字符,你会收到一个讽刺的告别信息(见上图)。 ### 5x5 ![5x5 game grid](https://www.masteringemacs.org/static/uploads/5x5.png) +5x5 的游戏是一个逻辑解密游戏:你有一个 5x5 的网格,中间的十字被填满;你的目标是通过按正确的顺序切换它们的空满状态来填充所有的单元格,从而获得胜利。这并不像听起来那么容易! -5x5 的游戏是一个逻辑解密游戏:你有一个 5x5 的网格,中间的十字被填满;你的目标是通过按正确的顺序切换它们的空满状态来填充所有的单元格,从而获得胜利。这并不像听起来那么容易! +输入 `M-x 5x5` 就可以开始玩了,使用可选的数字参数可以改变网格的大小。这款游戏的有趣之处在于它能向你建议下一步行动并尝试找到该游戏网格的解法。它用到了 Emacs 自己的一款非常酷的符号 RPN 计算器 `M-x calc`(在《[Emacs 快乐计算][3]》这篇文章中,我使用它来解决了一个简单的问题)。 -输入 `M-x 5x5` 就可以开始玩了,使用可选的数字参数可以改变网格的大小。 -这款游戏的有趣之处在于它能向你建议下一步行动并尝试解决该游戏网格。它用到了了 Emacs 自己的一款非常酷的符号 RPN 计算器 `M-x calc` (在 [Fun with Emacs Calc][3] 这篇文章中,我使用它来解决了一个简单的问题。) +所以我喜欢这个游戏的原因是它提供了一个非常复杂的解题器——真的,你应该通过 `M-x find-library RET 5x5` 来阅读其源代码——这是一个试图通过暴力破解游戏解法的“破解器”。 -所以我喜欢这个游戏的原因是它提供了一个非常复杂的解决器——真的,你应该通过 `M-x find-library RET 5x5` 来阅读其源代码——和一个试图通过强力破解游戏的“破解器”。 +创建一个更大的游戏网格,例如输入 `M-10 M-x 5x5`,然后运行下面某个 `crack` 命令。破解器将尝试通过迭代获得最佳解决方案。它会实时运行该游戏,观看起来非常有趣: -创建一个更大的游戏网格,例如输入 `M-10 M-x 5x5`,然后运行下面某个 `crack` 命令。破坏者将尝试通过迭代获得最佳解决方案。它会实时运行该游戏,观看起来非常有趣: - -- `M-x 5x5-crack-mutating-best`: 试图通过修改最佳解决方案来破解 5x5。 - -- `M-x 5x5-crack-mutating-current`: 试图通过修改当前解决方案来破解 5x5。 - -- `M-x 5x5-crack-random`: 尝试使用随机方案解破解 5x5。 - -- `M-x 5x5-crack-xor-mutate`: 尝试通过将当前方案和最佳方案进行异或运算来破解 5x5。 +- `M-x 5x5-crack-mutating-best`: 试图通过变异最佳解决方案来破解 5x5。 +- `M-x 5x5-crack-mutating-current`: 试图通过变异当前解决方案来破解 5x5。 +- `M-x 5x5-crack-random`: 尝试使用随机方案解破解 5x5。 +- `M-x 5x5-crack-xor-mutate`: 尝试通过将当前方案和最佳方案进行异或运算来破解 5x5。 ### 文本动画 -您可以通过运行 `M-x animation-birthday-present` 并给出名字来显示一个奇特的生日礼物动画。它看起来很酷! +你可以通过运行 `M-x animation-birthday-present` 并给出你的名字来显示一个奇特的生日礼物动画。它看起来很酷! ![xkcd](https://imgs.xkcd.com/comics/real_programmers.png) -`M-x butterfly` 命令中也使用了 `animate` 包,butterfly 命令被添加到 Emacs 中,以向上面的 [XKCD][4] 漫画致敬。当然,漫画中的 Emacs 命令在技术上是无效的,但它的幽默足以弥补这一点。 +这里用的 `animate` 包也用在了 `M-x butterfly` 命令中,这是一个向上面的 [XKCD][4] 漫画致敬而添加到 Emacs 中的命令。当然,漫画中的 Emacs 命令在技术上是无效的,但它的幽默足以弥补这一点。 ### 黑箱 我将逐字引用这款游戏的目标: > 游戏的目标是通过向黑盒子发射光线来找到四个隐藏的球。有四种可能: -> 1) 射线将通过盒子不受干扰, -> 2) 它将击中一个球并被吸收, +> 1) 射线将通过盒子不受干扰; +> 2) 它将击中一个球并被吸收; > 3) 它将偏转并退出盒子,或 -> 4) 立即偏转,甚至不被允许进入盒子。 +> 4) 立即偏转,甚至不能进入盒子。 -所以,这有点像我们小时候玩的 [Battleship][5],但是……是专为物理专业高学历的人准备的? +所以,这有点像我们小时候玩的[战舰游戏][5],但是……是专为物理专业高学历的人准备的吧? -这是另一款添加于 20 世纪 80 年代的游戏。我建议你输入 `C-h f blackbox` 来阅读玩法说明(文档巨大)。 +这是另一款添加于 20 世纪 80 年代的游戏。我建议你输入 `C-h f blackbox` 来阅读玩法说明(文档巨大)。 ### 泡泡 ![Bubbles game](https://www.masteringemacs.org/static/uploads/bubbles.png) +`M-x bubble` 游戏相当简单:你必须用尽可能少移动清除尽可能多的“泡泡”。当你移除气泡时,其他气泡会掉落并粘在一起。这是一款有趣的游戏,此外如果你使用 Emacs 的图形用户界面,它还支持图像显示。而且它还支持鼠标。 -`M-x bubble` 游戏相当简单:你必须用尽可能少移动清除尽可能多的“泡泡”。当你移除气泡时,其他气泡会掉落并粘在一起。 -这是一款有趣的游戏,此外如果你使用 Emacs 的图形用户界面,它还支持图像现实。而且它还支持鼠标。 - -您可以通过调用 `M-x bubbles-set-game-< 难度>` 来设置难度,其中嗯 `<难度>` 可以是其中之一:`easy`,`medium=,=difficult`,`hard`,或 `userdefined`。 -此外,您可以使用:`M-x custom-group bubbles` 来更改图形、网格大小和颜色。 +你可以通过调用 `M-x bubbles-set-game-` 来设置难度,其中 `` 可以是这些之一:`easy`、`medium`、`difficult`、`hard` 或 `userdefined`。此外,你可以使用:`M-x custom-group bubbles` 来更改图形、网格大小和颜色。 由于它即简单又有趣,这是 Emacs 中我最喜欢的游戏之一。 ### 幸运饼干 -我喜欢 `fortune` 命令。每当我启动一个新 shell 时,就会有刻薄、无益、常常带有讽刺意味的“建议(以及文学摘要,谜语)”就会点亮我的一天。 +我喜欢 `fortune` 命令。每当我启动一个新 shell 时,这些与文学片段、谜语相结合的刻薄、无益、常常带有讽刺意味的“建议”就会点亮我的一天。 -令人困惑的是,Emacs 中有两个包做了类似的事情:`fortune` 和 `cookie`。前者主要用于在电子邮件签名中添加幸运饼干消息,而后者只是一个简单的 fortune 格式阅读器。 +令人困惑的是,Emacs 中有两个包或多或少地做着类似的事情:`fortune` 和 `cookie1`。前者主要用于在电子邮件签名中添加幸运饼干消息,而后者只是一个简单的 fortune 格式阅读器。 -不管怎样,使用 Emacs 的 `cookie` 包前,你首先需要通过 `customize-option RET cookie RET` 来自定义变量 `cookie-file` 告诉它从哪找到 fortune 文件。 +不管怎样,使用 Emacs 的 `cookie1` 包前,你首先需要通过 `customize-option RET cookie RET` 来自定义变量 `cookie-file` 告诉它从哪找到 fortune 文件。 如果你的操作系统是 Ubuntu,那么你先安装 `fortune` 软件包,然后就能在 `/usr/share/games/fortune/` 目录中找到这些文件了。 -之后你就可以调用 `M-x cookie` 随机显示 fortune 内容,或者,如果你想的话,也可以调用 `M-x cookie-apropos` 查找所有匹配的 cookie。 +之后你就可以调用 `M-x cookie` 随机显示 fortune 内容,或者,如果你想的话,也可以调用 `M-x cookie-apropos` 查找所有匹配的饼干。 -### Decipher +### 破译器 -这个包完美地抓住了 Emacs 的实用本质:这个包为你破解简单的替换密码(如密码谜题)提供了一个很有用的界面。 -你知道,二十多年前,某人确实迫切需要破解很多基础密码。正是像这个模块这样的小玩意让我非常高兴地用起 Emacs 来:这个模块只对少数人有用,但是,如果你突然需要它了,那么它就在那里等着你。 +这个包完美地抓住了 Emacs 的功利本质:这个包为你破解简单的替换密码(如“密码谜题”)提供了一个很有用的界面。你知道,二十多年前,有些人确实迫切需要破解很多基本的密码。正是像这个模块这样的小玩意让我非常高兴地用起 Emacs 来:一个只对少数人有用的模块,但是,如果你突然需要它了,那么它就在那里等着你。 那么如何使用它呢?让我们假设使用 “rot13” 密码:在 26 个字符的字母表中,将字符旋转 13 个位置。 -通过 `M-x ielm` (Emacs 用于 [运行 Elisp][6] 的 REPL 环境)可以很容易在 Emacs 中进行尝试: - +通过 `M-x ielm` (Emacs 用于 [运行 Elisp][6] 的 REPL 环境)可以很容易在 Emacs 中进行尝试: ``` *** Welcome to IELM *** Type (describe-mode) for help. @@ -117,21 +102,20 @@ ELISP> (rot13 "Uryyb, Jbeyq") ELISP> ``` -那么,decipher 模块又是如何帮助我们的呢?让我们创建一个新的缓冲区 `test-cipher` 并输入您的密码文本(在我的例子中是 `Uryyb,Jbeyq`) +简而言之,你将明文旋转了 13 个位置,就得到了密文。你又旋转了一次 13 个位置,就返回了最初的明文。 这就是这个包可以帮助你解决的问题。 + +那么,decipher 模块又是如何帮助我们的呢?让我们创建一个新的缓冲区 `test-cipher` 并输入你的密文(在我的例子中是 `Uryyb,Jbeyq`)。 ![cipher](https://www.masteringemacs.org/static/uploads/cipher.png) -您现在面对的是一个相当复杂的接口。现在把光标放在紫行秘文中的任意字符上,猜猜这个字符可能是什么:Emacs 将根据你的选择更新其他明文的猜测结果,并告诉你字母表中的字符是如何分配的。 +你现在面对的是一个相当复杂的界面。现在把光标放在紫色行的密文的任意字符上,并猜测这个字符可能是什么:Emacs 将根据你的选择更新其他明文的猜测结果,并告诉你目前为止字母表中的字符是如何分配的。 -您现在可以下面各种 helper 命令来帮助推断密码字符可能对应的明文字符: +你现在可以用下面各种助手命令来关闭选项,以帮助推断密码字符可能对应的明文字符: -- **`D`:** 显示数字符号(密码中两个字符组合)及其频率的列表 - -- **`F`:** 表示每个密文字母的频率 - -- **`N`:** 显示字符的邻接信息。我不确定这是干啥的。 - -- **`M` 和 `R`:** 保存和恢复一个检查点,允许你对工作进行分支以探索破解密码的不同方法。 +- `D`: 列出示意图(该加密算法中双字符对)及其频率 +- `F`: 表示每个密文字母的频率 +- `N`: 显示字符的邻近信息。我不确定这是干啥的。 +- `M` 和 `R`: 保存和恢复一个检查点,允许你对工作进行分支以探索破解密码的不同方法。 总而言之,对于这样一个深奥的任务,这个包是相当令人印象深刻的!如果你经常破解密码,也许这个程序包能帮上忙? @@ -139,36 +123,35 @@ ELISP> ![doctor](https://www.masteringemacs.org/static/uploads/doctor.png) -啊,Emacs 医生。其基于最初的 [ELIZA][7],“ 医生”试图对你说的话进行心理分析,并试图把问题复述给你。体验它的那几分钟相当有趣,它也是 Emacs 中最著名的古怪玩意之一。你可以使用 `M-x doctor` 来运行它。 +啊,Emacs 医生。其基于最初的 [ELIZA][7],“医生”试图对你说的话进行心理分析,并试图把问题复述给你。体验几分钟,相当有趣,它也是 Emacs 中最著名的古怪玩意之一。你可以使用 `M-x doctor` 来运行它。 ### Dunnet -Emacs 自己特有的类 Zork 文本冒险游戏。输入 `M-x dunnet` 就能玩了。 -这是一款相当不错的游戏,虽然时间不长,但非常著名,很少有人真正玩到最后。 +Emacs 自己特有的类 Zork 文字冒险游戏。输入 `M-x dunnet` 就能玩了。这是一款相当不错的游戏,简单的说,它是另一款非常著名的 Emacs 游戏,很少有人真正玩到通关。 如果你发现自己能在无聊的文档工作之间空出时间来,那么这是一个超级棒的游戏,内置“老板屏幕”,因为它是纯文本的。 -哦,还有,不要吃掉那块 CPU 卡 :) +哦,还有,不要想着吃掉那块 CPU 卡 :) ### 五子棋 ![gomoku](https://www.masteringemacs.org/static/uploads/gomoku.png) -另一款写于 20 世纪 80 年代的游戏。你必须连接 5 个方块,井字游戏风格。你可以运行 `M-x gomoku` 来与 Emacs 对抗。游戏还支持鼠标,非常方便。您也可以自定义 `gomoku` 组来调整网格的大小。 +另一款写于 20 世纪 80 年代的游戏。你必须将 5 个方块连成一条线,井字棋风格。你可以运行 `M-x gomoku` 来与 Emacs 对抗。游戏还支持鼠标,非常方便。你也可以自定义 `gomoku` 组来调整网格的大小。 ### 生命游戏 -[Conway 的生命游戏 ][8] 是细胞自动机的一个著名例子。Emacs 版本提供了一些启动模式,你可以(通过 elisp 编程)通过调整 `life-patterns` 变量来更改这些模式。 +[康威的生命游戏][8] 是细胞自动机的一个著名例子。Emacs 版本提供了一些启动模式,你可以(通过 elisp 编程)调整 `life-patterns` 变量来更改这些模式。 -你可以用 `M-x life` 触发生命游戏。事实上,所有的东西,包括代码,注释和所有的东西,总共不到 300 行,这也让人印象深刻。 +你可以用 `M-x life` 触发生命游戏。事实上,所有的东西,包括显示代码、注释等等一切,总共不到 300 行,这也让人印象深刻。 ### 乒乓,贪吃蛇和俄罗斯方块 ![tetris](https://www.masteringemacs.org/static/uploads/tetris.png) -这些经典游戏都是使用 Emacs 包 `gamegrid` 实现的,这是一个用于构建网格游戏(如俄罗斯方块和贪吃蛇)的通用框架。gamegrid 包的伟大之处在于它同时兼容图形化和终端 Emacs: 如果你在 GUI 中运行 Emacs,你会得到精美的图形;如果你没有,你得到简单的 ASCII 艺术。 +这些经典游戏都是使用 Emacs 包 `gamegrid` 实现的,这是一个用于构建网格游戏(如俄罗斯方块和贪吃蛇)的通用框架。gamegrid 包的伟大之处在于它同时兼容图形化和终端 Emacs:如果你在 GUI 中运行 Emacs,你会得到精美的图形;如果你没有,你看到简单的 ASCII 艺术。 -你可以通过输入 `M-x pong`,`M-x snake`,`M-x tetris` 来运行这些游戏。 +你可以通过输入 `M-x pong`、`M-x snake`、`M-x tetris` 来运行这些游戏。 特别是俄罗斯方块游戏实现的非常到位,会逐渐增加速度并且能够滑块。而且既然你已经有了源代码,你完全可以移除那个讨厌的 Z 形块,没人喜欢它! @@ -176,8 +159,7 @@ Emacs 自己特有的类 Zork 文本冒险游戏。输入 `M-x dunnet` 就能玩 ![solitaire image](https://www.masteringemacs.org/static/uploads/solitaire.png) -可惜,这不是纸牌游戏,而是一个基于 peg 的游戏,你可以选择一块石头 (`o`) 并“跳过”相邻的石头进入洞中(`。`),并在这个过程中去掉你跳过的那些石头,最终只能在棋盘上留下一块石头, -重复该过程直到板子被请空(只保留一个石头)。 +可惜,这不是纸牌游戏,而是一个基于“钉子”的游戏,你可以选择一块石头(`o`)并“跳过”相邻的石头进入洞中(`.`),并在这个过程中去掉你跳过的石头,最终只能在棋盘上留下一块石头,重复该过程直到棋盘被请空(只保留一个石头)。 如果你卡住了,有一个内置的解题器名为 `M-x solitire-solve`。 @@ -187,16 +169,15 @@ Emacs 自己特有的类 Zork 文本冒险游戏。输入 `M-x dunnet` 就能玩 输入 `M-x zone`,然后看看屏幕上发生了什么! -您可以通过运行 `M-x zone-when-idle` (或从 elisp 调用它)来配置屏幕保护程序的空闲时间,时间以秒为单位。 -您也可以通过 `M-x zone-leave-me-alone` 来关闭它。 +你可以通过运行 `M-x zone-when-idle`(或从 elisp 调用它)来配置屏幕保护程序的空闲时间,时间以秒为单位。你也可以通过 `M-x zone-leave-me-alone` 来关闭它。 -如果它在你的同事看着的时候被启动,你的同事肯定会抓狂的。 +如果在你的同事看着的时候启动它,你的同事肯定会抓狂的。 ### 乘法解谜 ![mpuz](https://www.masteringemacs.org/static/uploads/mpuz.png) -这是另一个脑筋急转弯的益智游戏。当您运行 `M-x mpuz` 时,将看到一个乘法解谜题,你必须将字母替换为对应的数字,并确保数字相加(相乘?)符合结果 +这是另一个脑筋急转弯的益智游戏。当你运行 `M-x mpuz` 时,将看到一个乘法解谜题,你必须将字母替换为对应的数字,并确保数字相加(相乘?)符合结果。 如果遇到难题,可以运行 `M-x mpuz-show-solution` 来解决。 @@ -205,19 +186,15 @@ Emacs 自己特有的类 Zork 文本冒险游戏。输入 `M-x dunnet` 就能玩 还有更多好玩的东西,但它们就不如刚才那些那么好玩好用了: - 你可以通过 `M-x morse-region` 和 `M-x unmorse-region` 将一个区域翻译成莫尔斯电码。 -- Dissociated Press 是一个非常简单的命令,它将类似随机游动 markov 链生成器应用到 buffer 中的文本中,并以此生成无意义的文本。试一下 `M-x dissociated-press`。 -- Gamegrid 包是构建网格游戏的通用框架。到目前为止,只有俄罗斯方块,乒乓和贪吃蛇使用了它。其名为 `gamegrid`。 +- Dissociated Press 是一个非常简单的命令,它将一个类似随机穿行的马尔可夫链生成器应用到缓冲区中的文本中,并以此生成无意义的文本。试一下 `M-x dissociated-press`。 - `gametree` 软件包是一个通过电子邮件记录和跟踪国际象棋游戏的复杂方法。 -- `M-x spook` 命令插入随机单词(通常是在电子邮件中),目的是混淆/超载 “NSA trukn trawler”—— 记住,这个模块可以追溯到 20 世纪 80 年代和 90 年代——那时应该有间谍们在监听各种单词。当然,即使是在十年前,这样做也会显得非常偏执和古怪,不过现在看来已经不那么奇怪了…… +- `M-x spook` 命令插入随机单词(通常是到电子邮件中),目的是混淆/超载 “NSA 拖网渔船” —— 记住,这个模块可以追溯到 20 世纪 80 年代和 90 年代,那时应该有间谍们在监听各种单词。当然,即使是在十年前,这样做也会显得非常偏执和古怪,不过现在看来已经不那么奇怪了…… +### 总结 -### 结论 +我喜欢 Emacs 附带的游戏和玩具。它们大多来自于,嗯,我们姑且称之为一个不同的时代:一个允许或甚至鼓励奇思妙想的时代。有些玩意非常经典(如俄罗斯方块和汉诺塔),有些对经典游戏进行了有趣的变种(如黑盒)——但我很高兴这么多年后它们依然存在于 Emacs 中。我想知道时至今日,类似这些的玩意是否还会再纳入 Emacs 的代码库中;嗯,它们很可能不会——它们将被归入包管理仓库中,而在这个干净而无菌的世界中,它们无疑属于包管理仓库。 -我喜欢 Emacs 附带的游戏和玩具。它们大多来自于,嗯,我们姑且称之为一个不同的时代:一个允许或甚至鼓励奇思妙想的时代。 -有些玩意非常经典(如俄罗斯方块和汉诺塔),有些对经典游戏进行了有趣的变种(如黑盒)——但我很高兴这么多年后他们依然在 Emacs 中。 -我想知道时至今日,这些玩意是否还会纳入 Emacs 的代码库中;嗯,它们很可能不会——它们将被归入包管理仓库中,而在这个干净而贫瘠的世界中,它们无疑属于包管理仓库。 - -Emacs 要求将对 Emacs 体验不重要的内容转移到包管理仓库 ELPA 中。我的意思是,作为一个开发者,这是有道理的,但是……对于每一个被移出并流放到 ELPA 的包,我们都在蚕食 Emacs 的精髓。 +Emacs 要求将对 Emacs 体验不重要的内容转移到包管理仓库 ELPA 中。我的意思是,作为一个开发者,这是有道理的,但是……对于每一个被移出并流放到 ELPA 的包,我们是不是在蚕食 Emacs 的精髓? -------------------------------------------------------------------------------- @@ -227,7 +204,7 @@ via: https://www.masteringemacs.org/article/fun-games-in-emacs 作者:[Mickey Petersen][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bcf69025122cd9c1fc1454d83b3702a09e2b5ced Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 28 Feb 2020 13:12:25 +0800 Subject: [PATCH 127/260] PRF @heguangzhi --- ...came the Standard for Compute Resources.md | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md b/translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md index 901635d6a5..135cfc1b07 100644 --- a/translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md +++ b/translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How Kubernetes Became the Standard for Compute Resources) @@ -10,28 +10,27 @@ Kubernetes 如何成为计算资源的标准 ====== +![](https://www.linux.com/wp-content/uploads/2019/08/elevator-1598431_1920.jpg) - +对于原生云生态系统来说,2019 年是改变游戏规则的一年。有大的[并购][1],如 Red Hat Docker 和 Pivotal,并出现其他的玩家,如 Rancher Labs 和 Mirantis。 -对于原生云生态系统来说,2019年是改变游戏规则的一年。有大的[并购][1),如 Red Hat Docker 和 Pivotal,并出现其他的玩家 如Rancher Labs 和 Mirantis 。 +Rancher Labs (一家为采用容器的团队提供完整软件栈的公司)的联合创始人兼首席执行官盛亮表示:“所有这些整合和并购,都表明这一领域的市场成熟的速度很快。” -“所有这些并购",Rancher Labs (一家为采用容器的团队提供完整软件栈的公司) 的联合创始人兼首席执行官盛亮表示:“这一领域的成功表明市场成熟的速度很快。”。 +传统上,像 Kubernetes 和 Docker 这样的新兴技术吸引着开发者和像脸书和谷歌这样的超级用户。除了这群人之外则没什么兴趣。然而,这两种技术都在企业层面得到了广泛采用。突然间,出现了一个巨大的市场,有着巨大的机会。几乎每个人都跳了进去。有人带来了创新的解决方案,也有人试图赶上其他人。它很快变得非常拥挤和热闹起来。 -传统上,像 Kubernetes 和 Docker 这样的新兴技术吸引着开发者和像脸书和谷歌这样的超级用户。这群人之外没什么其他的兴趣。然而,这两种技术都在企业层面得到了广泛采用。突然间,有了一个巨大的市场,有了巨大的机会。几乎每个人都跳了进去。有人带来了创新的解决方案,也有人试图赶上其他人。它很快变得非常拥挤和热闹起来。 +它也改变了创新的方式。[早期采用者通常是精通技术的公司][2]。现在,几乎每个人都在使用它,即使是在不被认为是 Kubernetes 地盘的地方。它改变了市场动态,像 Rancher Labs 这样的公司见证了独特的用例。 -它也改变了创新的方式。[早期采用者通常是精通技术的公司。][2]现在,几乎每个人都在使用它,即使是在不被认为是 Kubernetes 地盘的地方。它改变了市场动态,像 Rancher Labs 这样的公司见证了独特的用例。 - -梁补充道,“我从来没有经历过像 Kubernete 这样快速、动态的市场或这样的技术进化。当我们五年前开始的时候,这是一个非常拥挤的空间。随着时间的推移,我们大多数的同龄人因为这样或那样的原因消失了。他们要么无法适应变化,要么选择不适应某些变化。” +盛亮补充道,“我从来没有经历过像 Kubernete 这样快速、动态的市场或技术演变。当我们五年前开始的时候,这是一个非常拥挤的空间。随着时间的推移,我们大多数的友商因为这样或那样的原因消失了。他们要么无法适应变化,要么选择不适应某些变化。” 在 Kubernetes 的早期,最明显的机会是建立 Kubernetes 发行版本和 Kubernetes 业务。这是新技术。众所周知,它的安装、升级和操作相当的复杂。 -当谷歌、AWS 和微软进入市场时,一切都变了。当时,有一群供应商蜂拥而至,为平台提供解决方案。梁表示:“一旦像谷歌这样的云提供商决定将Kubernetes 作为一项服务,并亏本出售的商品免费提供,以推动基础设施消费;我们就知道,运营和支持 Kubernetes 业务的优势将非常有限了。”。 +当谷歌、AWS 和微软进入市场时,一切都变了。当时,一群供应商蜂拥而至,为平台提供解决方案。盛亮表示:“一旦像谷歌这样的云提供商决定将 Kubernetes 作为一项服务,并免费提供亏本出售的商品,以推动基础设施消费;我们就知道,运营和支持 Kubernetes 业务的优势将非常有限了。” -对非谷歌玩家来说,并非一切都不好。由于云供应商通过将它作为服务来提供,消除了 Kubernetes 带来的所有复杂性,这意味着更广泛地采用该技术,即使是那些由于运营成本而不愿使用该技术的人也是如此。这意味着 Kubernetes 将变得无处不在,并将成为一个行业标准。 +对谷歌之外的其它玩家来说,并非一切都不好。由于云供应商通过将它作为服务来提供,消除了 Kubernetes 带来的所有复杂性,这意味着更广泛地采用该技术,即使是那些由于运营成本而不愿使用该技术的人也是如此。这意味着 Kubernetes 将变得无处不在,并将成为一个行业标准。 -“Rancher Labs 是极少数将此视为机遇并比其他公司看得更远的公司之一。我们意识到 Kubernetes 将成为新的计算标准,就像TCP/IP成为网络标准一样,”梁说。 +“Rancher Labs 是极少数将此视为机遇并比其他公司看得更远的公司之一。我们意识到 Kubernetes 将成为新的计算标准,就像 TCP/IP 成为网络标准一样,”盛亮说。 -CNCF围绕 Kubernetes 构建一个充满活力的生态系统方面发挥着至关重要的作用,创建了一个庞大的社区来构建、培育和商业化原生云开源技术。 +CNCF 在围绕 Kubernetes 构建一个充满活力的生态系统方面发挥着至关重要的作用,创建了一个庞大的社区来构建、培育和商业化原生云开源技术。 -------------------------------------------------------------------------------- @@ -40,7 +39,7 @@ via: https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compu 作者:[Swapnil Bhartiya][a] 选题:[lujun9972][b] 译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 18a96ff143d250f947aac6e59e7e5a237c6032a5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 28 Feb 2020 13:17:56 +0800 Subject: [PATCH 128/260] PUB @heguangzhi https://linux.cn/article-11940-1.html --- ... Kubernetes Became the Standard for Compute Resources.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200219 How Kubernetes Became the Standard for Compute Resources.md (96%) diff --git a/translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md b/published/20200219 How Kubernetes Became the Standard for Compute Resources.md similarity index 96% rename from translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md rename to published/20200219 How Kubernetes Became the Standard for Compute Resources.md index 135cfc1b07..3d1a903916 100644 --- a/translated/tech/20200219 How Kubernetes Became the Standard for Compute Resources.md +++ b/published/20200219 How Kubernetes Became the Standard for Compute Resources.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11940-1.html) [#]: subject: (How Kubernetes Became the Standard for Compute Resources) [#]: via: (https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compute-resources/) [#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) @@ -10,7 +10,7 @@ Kubernetes 如何成为计算资源的标准 ====== -![](https://www.linux.com/wp-content/uploads/2019/08/elevator-1598431_1920.jpg) +![](https://img.linux.net.cn/data/attachment/album/202002/28/131634mwzyylmv93m4ccws.jpg) 对于原生云生态系统来说,2019 年是改变游戏规则的一年。有大的[并购][1],如 Red Hat Docker 和 Pivotal,并出现其他的玩家,如 Rancher Labs 和 Mirantis。 From f70ccaf54e435f48a09810655536dfd538a0bade Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 28 Feb 2020 14:27:25 +0800 Subject: [PATCH 129/260] PRF @geekpi --- ...217 How to get MongoDB Server on Fedora.md | 87 ++++++++----------- 1 file changed, 35 insertions(+), 52 deletions(-) diff --git a/translated/tech/20200217 How to get MongoDB Server on Fedora.md b/translated/tech/20200217 How to get MongoDB Server on Fedora.md index c7da999f65..604e85c184 100644 --- a/translated/tech/20200217 How to get MongoDB Server on Fedora.md +++ b/translated/tech/20200217 How to get MongoDB Server on Fedora.md @@ -1,116 +1,99 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to get MongoDB Server on Fedora) [#]: via: (https://fedoramagazine.org/how-to-get-mongodb-server-on-fedora/) [#]: author: (Honza Horak https://fedoramagazine.org/author/hhorak/) -如何在 Fedora 上获取 MongoDB 服务器 +如何在 Fedora 上安装 MongoDB 服务器 ====== ![][1] -Mongo(来自 “humongous”)是一个高性能,开源,无模式的面向文档的数据库,它是最受欢迎的 [NoSQL][2] 数据库之一。它使用 JSON 作为文档格式,并且可以在多个服务器节点之间进行扩展和复制。 +Mongo(来自 “humongous” —— 巨大的)是一个高性能、开源、无模式的、面向文档的数据库,它是最受欢迎的 [NoSQL][2] 数据库之一。它使用 JSON 作为文档格式,并且可以在多个服务器节点之间进行扩展和复制。 ### 有关许可证更改的故事 -上游 MongoD 决定更改服务器代码的许可证已经一年多了。先前的许可证是 GNU Affero General Public License v3(AGPLv3)。但是,上游写了一个新许可证,为了使运行 MongoDB 即服务的公司回馈社区。新许可证称为 Server Side Public License(SSPLv1),关于这个及其原理的更多说明,请参见[MongoDB SSPL FAQ][3]。 +MongoDB 上游决定更改服务器代码的许可证已经一年多了。先前的许可证是 GNU Affero General Public License v3(AGPLv3)。但是,上游公司写了一个新许可证,旨在使运行 MongoDB 即服务的公司可以回馈社区。新许可证称为 Server Side Public License(SSPLv1),关于这个举措及其解释的更多说明,请参见 [MongoDB SSPL FAQ][3]。 -Fedora 一直只包含自由软件。当 SSPL 发布后,Fedora [确定][4]它并不是自由软件许可。许可证更改日期(2018 年 10 月)之前发布的所有 MongoDB 版本都可保留在 Fedora 中,但之后再也不更新软件包会带来安全问题。因此,从 Fedora 30 开始,Fedora 社区决定完全[移除 MongoDB 服务器][5]。 +Fedora 一直只包含自由软件。当 SSPL 发布后,Fedora [确定][4]它并不是自由软件许可证。许可证更改日期(2018 年 10 月)之前发布的所有 MongoDB 版本都可保留在 Fedora 中,但之后再也不更新的软件包会带来安全问题。因此,从 Fedora 30 开始,Fedora 社区决定完全[移除 MongoDB 服务器][5]。 ### 开发人员还有哪些选择? 是的,还有替代方案,例如 PostgreSQL 在最新版本中也支持 JSON,它可以在无法再使用 MongoDB 的情况下使用它。使用 JSONB 类型,索引在 PostgreSQL 中可以很好地工作,其性能可与 MongoDB 媲美,甚至不会受到 ACID 的影响。 -开发人员可能选择 MongoDB 的技术原因并未随许可证而改变,因此许多人仍想使用它。重要的是要意识到,SSPL 许可证仅更改仅针对 MongoDB 服务器。MongoDB 上游还开发了其他项目,例如 MongoDB 工具,C 和 C++ 客户端库以及用于各种动态语言的连接器,这些项目在客户端(要通过网络与服务器通信的应用中)使用。由于这些包的许可证是自由的(主要是 Apache 许可证),因此它们保留在 Fedora 仓库中,因此用户可以将其用于应用开发。 +开发人员可能选择 MongoDB 的技术原因并未随许可证而改变,因此许多人仍想使用它。重要的是要意识到,SSPL 许可证仅更改仅针对 MongoDB 服务器。MongoDB 上游还开发了其他项目,例如 MongoDB 工具、C 和 C++ 客户端库以及用于各种动态语言的连接器,这些项目在客户端使用(通过网络与服务器通信的应用中)。由于这些包的许可证人保持自由(主要是 Apache 许可证),因此它们保留在 Fedora 仓库中,因此用户可以将其用于应用开发。 -唯一的变化实际是服务器包本身,它已从 Fedora 仓库中完全删除。让我们看看 Fedora 用户可以如何获取非自由的包。 +唯一的变化实际是服务器软件包本身,它已从 Fedora 仓库中完全删除。让我们看看 Fedora 用户可以如何获取非自由的包。 ### 如何从上游安装 MongoDB 服务器 当 Fedora 用户想要安装 MongoDB 服务器时,他们需要直接向上游获取 MongoDB。但是,上游不为 Fedora 提供 RPM 包。相反,MongoDB 服务器可以获取源码 tarball,用户需要自己进行编译(这需要一些开发知识),或者 Fedora 用户可以使用一些兼容的包。在兼容的选项中,最好的选择是 RHEL-8 RPM。以下步骤描述了如何安装它们以及如何启动守护进程。 -#### 1\. 使用上游 RPM 创建仓库(RHEL-8 构建) -``` +#### 1、使用上游 RPM 创建仓库(RHEL-8 构建) ``` - -$ sudo cat > /etc/yum.repos.d/mongodb.repo &lt;&lt;EOF +$ sudo cat > /etc/yum.repos.d/mongodb.repo >>EOF [mongodb-upstream] name=MongoDB Upstream Repository -baseurl= +baseurl=https://repo.mongodb.org/yum/redhat/8Server/mongodb-org/4.2/x86_64/ gpgcheck=1 enabled=1 -gpgkey= +gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc EOF ``` -``` - -#### 2\. 安装元软件包,来拉取服务器和工具包 -``` +#### 2、安装元软件包,来拉取服务器和工具包 ``` - $ sudo dnf install mongodb-org -&lt;snipped> +...... Installed: -  mongodb-org-4.2.3-1.el8.x86_64           mongodb-org-mongos-4.2.3-1.el8.x86_64   -  mongodb-org-server-4.2.3-1.el8.x86_64    mongodb-org-shell-4.2.3-1.el8.x86_64 -  mongodb-org-tools-4.2.3-1.el8.x86_64           + mongodb-org-4.2.3-1.el8.x86_64 mongodb-org-mongos-4.2.3-1.el8.x86_64 + mongodb-org-server-4.2.3-1.el8.x86_64 mongodb-org-shell-4.2.3-1.el8.x86_64 + mongodb-org-tools-4.2.3-1.el8.x86_64 Complete! ``` -``` - -#### 3\. 启动 MongoDB 守护进程 -``` +#### 3、启动 MongoDB 守护进程 ``` - $ sudo systemctl status mongod ● mongod.service - MongoDB Database Server -   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) -   Active: active (running) since Sat 2020-02-08 12:33:45 EST; 2s ago -     Docs: -  Process: 15768 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS) -  Process: 15769 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS) -  Process: 15770 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS) -  Process: 15771 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS) - Main PID: 15773 (mongod) -   Memory: 70.4M -      CPU: 611ms -   CGroup: /system.slice/mongod.service -           └─15773 /usr/bin/mongod -f /etc/mongod.conf -``` + Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) + Active: active (running) since Sat 2020-02-08 12:33:45 EST; 2s ago + Docs: https://docs.mongodb.org/manual + Process: 15768 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS) + Process: 15769 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS) + Process: 15770 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS) + Process: 15771 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS) + Main PID: 15773 (mongod) + Memory: 70.4M + CPU: 611ms + CGroup: /system.slice/mongod.service ``` -#### 4\. 通过 mongo shell 连接服务器来验证是否运行 -``` +#### 4、通过 mongo shell 连接服务器来验证是否运行 ``` - $ mongo MongoDB shell version v4.2.3 -connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&amp;gssapiServiceName=mongodb +connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("20b6e61f-c7cc-4e9b-a25e-5e306d60482f") } MongoDB server version: 4.2.3 Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see -    -\--- - -> _ + http://docs.mongodb.org/ +--- ``` + -``` - -就是这样了。如你所见,RHEL-8 包完美兼容,只要 Fedora 包还与 RHEL-8 兼容,它就应该会一直兼容。 请注意,在使用时必须遵守 SSPLv1 许可证。 +就是这样了。如你所见,RHEL-8 包完美兼容,只要 Fedora 包还与 RHEL-8 兼容,它就应该会一直兼容。请注意,在使用时必须遵守 SSPLv1 许可证。 -------------------------------------------------------------------------------- @@ -119,7 +102,7 @@ via: https://fedoramagazine.org/how-to-get-mongodb-server-on-fedora/ 作者:[Honza Horak][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 394d4d2e958fdff1a5a304894c1735c753211f8c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 28 Feb 2020 14:29:01 +0800 Subject: [PATCH 130/260] PUB @geekpi https://linux.cn/article-11942-1.html --- .../20200217 How to get MongoDB Server on Fedora.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200217 How to get MongoDB Server on Fedora.md (98%) diff --git a/translated/tech/20200217 How to get MongoDB Server on Fedora.md b/published/20200217 How to get MongoDB Server on Fedora.md similarity index 98% rename from translated/tech/20200217 How to get MongoDB Server on Fedora.md rename to published/20200217 How to get MongoDB Server on Fedora.md index 604e85c184..8c5522b477 100644 --- a/translated/tech/20200217 How to get MongoDB Server on Fedora.md +++ b/published/20200217 How to get MongoDB Server on Fedora.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11942-1.html) [#]: subject: (How to get MongoDB Server on Fedora) [#]: via: (https://fedoramagazine.org/how-to-get-mongodb-server-on-fedora/) [#]: author: (Honza Horak https://fedoramagazine.org/author/hhorak/) From 8204a45dd2b7d1b57bea285c58790b88156e2314 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 29 Feb 2020 00:55:39 +0800 Subject: [PATCH 131/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200228=20Fedora?= =?UTF-8?q?=E2=80=99s=20gaggle=20of=20desktops?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200228 Fedora-s gaggle of desktops.md --- .../20200228 Fedora-s gaggle of desktops.md | 411 ++++++++++++++++++ 1 file changed, 411 insertions(+) create mode 100644 sources/tech/20200228 Fedora-s gaggle of desktops.md diff --git a/sources/tech/20200228 Fedora-s gaggle of desktops.md b/sources/tech/20200228 Fedora-s gaggle of desktops.md new file mode 100644 index 0000000000..d92d84344a --- /dev/null +++ b/sources/tech/20200228 Fedora-s gaggle of desktops.md @@ -0,0 +1,411 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora’s gaggle of desktops) +[#]: via: (https://fedoramagazine.org/fedoras-gaggle-of-desktops/) +[#]: author: (Troy Dawson https://fedoramagazine.org/author/tdawson/) + +Fedora’s gaggle of desktops +====== + +![][1] + +There are 38 different desktops or window managers in Fedora 31. You could try a different one every day for a month, and still have some left over. Some have very few features. Some have so many features they are called a desktop environment. This article can’t go into detail on each, but it’s interesting to see the whole list in one place. + +### Criteria for desktops + +To be on this list, the desktop must show up on the desktop manager’s selection list. If the desktop has more than one entry in the desktop manager list, they are counted just as that one desktop. An example is “GNOME”, “GNOME Classic” and “GNOME (Wayland).” These all show up on the desktop manager list, but they are still just GNOME. + +### List of desktops +``` + +``` + +#### [**9wm**][2] + +``` +Emulation of the Plan 9 window manager 8 1/2 + dnf install 9wm +``` + +#### [**awesome**][3] + +``` +Highly configurable, framework window manager for X. Fast, light and extensible +https://fedoramagazine.org/5-cool-tiling-window-managers/ + dnf install awesome +``` + +#### [**blackbox**][4] + +``` +Very small and fast Window Manager +Fedora uses the maintained fork on github + dnf install blackbox +``` + +#### [**bspwm**][5] + +``` +A tiling window manager based on binary space partitioning +https://github.com/windelicato/dotfiles/wiki/bspwm-for-dummies + dnf install bspwm +``` + +#### **[byobu][6]** + +``` +Light-weight, configurable window manager built upon GNU screen + dnf install byobu +``` + +#### **[Cinnamon][7]** + +``` +Cinnamon provides a desktop with a traditional layout, advanced features, easy to use, powerful and flexible. +https://projects.linuxmint.com/cinnamon/ +https://opensource.com/article/19/12/cinnamon-linux-desktop + dnf group install "Cinnamon Desktop" +``` + +#### **[cwm][8]** + +``` +Calm Window Manager by OpenBSD project +https://steemit.com/technology/@jamesdeagle/the-calm-window-manager-cwm-a-quick-start-guide + dnf install cwm +``` + +#### **[Deepin][9]** + +``` +Deepin desktop is the desktop environment released with deepin (the linux distribution). It aims at being elegant and easy to use. + dnf group install "Deepin Desktop" + (optional) dnf group install "Deepin Desktop Office" "Media packages for Deepin Desktop" +``` + +#### **[dwm][10]** + +``` +Dynamic window manager for X +https://fedoramagazine.org/lets-try-dwm-dynamic-window-manger/ +https://fedoramagazine.org/5-cool-tiling-window-managers/ + dnf install dwm + (optional) dnf install dwm-user +``` + +#### **[enlightenment][11]** + +``` +Enlightenment window manager +https://opensource.com/article/19/12/linux-enlightenment-desktop + dnf install enlightenment +``` + +#### **[e16][11]** + +``` +The Enlightenment window manager, DR16 + dnf install e16 + (optional) dnf install e16-epplets e16-keyedit e16-themes +``` + +#### **[fluxbox][12]** + +``` +Window Manager based on Blackbox + dnf install fluxbox + (optional) dnf install fluxbox-pulseaudio fluxbox-vim-syntax +``` + +#### **[fvwm][13]** + +``` +Highly configurable multiple virtual desktop window manager +http://www.fvwm.org/ +https://opensource.com/article/19/12/fvwm-linux-desktop + dnf install fvwm +``` + +#### **[GNOME][14]** + +``` +GNOME is a highly intuitive and user friendly desktop environment. +* both X11 and wayland +https://opensource.com/article/19/12/gnome-linux-desktop +https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/ + dnf group install "GNOME" + (optional but large) dnf group install "Fedora Workstation" +``` + +#### **[herbstluftwm][15]** + +``` +A manual tiling window manager +https://opensource.com/article/19/12/herbstluftwm-linux-desktop + dnf install herbstluftwm + (optional) dnf install herbstluftwm-zsh herbstluftwm-fish +``` + +#### **[i3][16]** + +``` +Improved tiling window manager +https://fedoramagazine.org/getting-started-i3-window-manager/ +https://fedoramagazine.org/using-i3-with-multiple-monitors/ + dnf install i3 + (optional) dnf install i3-doc i3-ipc +``` + +#### **[icewm][17]** + +``` +Window manager designed for speed, usability, and consistency +https://fedoramagazine.org/icewm-a-really-cool-desktop/ + dnf install icewm + (optional) dnf install icewm-minimal-session +``` + +#### **[jwm][18]** + +``` +Joe's Window Manager +https://opensource.com/article/19/12/joes-window-manager-linux-desktop + dnf install jwm +``` + +#### **[KDE Plasma Desktop][19]** + +``` +The KDE Plasma Workspaces, a highly-configurable graphical user interface which includes a panel, desktop, system icons and desktop widgets, and many powerful KDE applications. +* both X11 and wayland +https://opensource.com/article/19/12/linux-kde-plasma +https://fedoramagazine.org/installing-kde-plasma-5/ + dnf group install "KDE Plasma Workspaces" + (optional) dnf group install "KDE Applications" "KDE Educational applications" "KDE Multimedia support" "KDE Office" "KDE Telepathy" + (optional for wayland) dnf install kwin-wayland plasma-workspace-wayland +``` + +#### **[lumina][20]** + +``` +A lightweight, portable desktop environment +https://opensource.com/article/19/12/linux-lumina-desktop + dnf install lumina-desktop + (optional) dnf install lumina-* +``` + +#### **[LXDE][21]** + +``` +LXDE is a lightweight X11 desktop environment designed for computers with low hardware specifications like netbooks, mobile devices or older computers. +https://opensource.com/article/19/12/lxqt-lxde-linux-desktop + dnf group install "LXDE Desktop" + (optional) dnf group install "LXDE Office" "Multimedia support for LXDE" +``` + +#### **[LXQt][22]** + +``` +LXQt is a lightweight X11 desktop environment designed for computers with low hardware specifications like netbooks, mobile devices or older computers. +https://opensource.com/article/19/12/lxqt-lxde-linux-desktop + dnf group install "LXQt Desktop" + (optional) dnf group install "LXQt Office" "Multimedia support for LXQt" +``` + +#### **[MATE][23]** + +``` +MATE Desktop is based on GNOME 2 and provides a powerful graphical user interface for users who seek a simple easy to use traditional desktop interface. +https://opensource.com/article/19/12/mate-linux-desktop +https://fedoramagazine.org/installing-another-desktop/ + dnf group install "MATE Desktop" + (optional) dnf group install "MATE Applications" +``` + +#### **[musca][24]** + +``` +A simple dynamic window manager fox X + dnf install musca +``` + +#### **[openbox][25]** + +``` +A highly configurable and standards-compliant X11 window manager +https://opensource.com/article/19/12/openbox-linux-desktop +https://fedoramagazine.org/openbox-fedora/ + dnf install openbox + (optional) dnf install openbox-kde openbox-theme-mistral-thin-dark +``` + +#### **[Pantheon][26]** + +``` +The Pantheon desktop environment is the DE that powers elementaryOS. +https://github.com/elementary +https://opensource.com/article/19/12/pantheon-linux-desktop + dnf group install "Pantheon Desktop" + (optional) dnf install elementary-capnet-assist elementary-greeter elementary-shortcut-overlay +``` + +#### **[pekwm][27]** + +``` +A small and flexible window manager +https://opensource.com/article/19/12/pekwm-linux-desktop + dnf install pekwm +``` + +#### **[qtile][28]** + +``` +A pure-Python tiling window manager +https://fedoramagazine.org/5-cool-tiling-window-managers/ + dnf install qtile +``` + +#### **[ratpoison][29]** + +``` +Minimalistic window manager +https://opensource.com/article/19/12/ratpoison-linux-desktop + dnf install ratpoison +``` + +#### **[sawfish][30]** + +``` +An extensible window manager for the X Window System + dnf install sawfish + (optional) dnf install sawfish-pager +``` + +#### **[spectrwm][31]** + +``` +Minimalist tiling window manager written in C + dnf install spectrwm +``` + +#### **[Sugar][32]** + +``` +A software playground for learning about learning. +* Possibly the most unique desktop of this list. + dnf group install "Sugar Desktop Environment" + (optional) dnf group install "Additional Sugar Activities" +``` + +#### **[sway][33]** + +``` +i3-compatible window manager for Wayland +* Wayland only +https://fedoramagazine.org/setting-up-the-sway-window-manager-on-fedora/ +https://fedoramagazine.org/5-cool-tiling-window-managers/ + dnf install sway +``` + +#### **[twm][34]** + +``` +X.Org X11 twm window manager +https://en.wikipedia.org/wiki/Twm +https://opensource.com/article/19/12/twm-linux-desktop + dnf install xorg-x11-twm +``` + +#### **[WindowMaker][35]** + +``` +A fast, feature rich Window Manager +https://opensource.com/article/19/12/linux-window-maker-desktop + dnf install WindowMaker + (optional) dnf install WindowMaker-extra +``` + +#### **[wmx][36]** + +``` +A really simple window manager for X + dnf install wmx +``` + +#### **[XFCE][37]** + +``` +A lightweight desktop environment that works well on low end machines. +https://opensource.com/article/19/12/xfce-linux-desktop + dnf group install "Xfce Desktop" + (optional) dnf group install "Applications for the Xfce Desktop" "Extra plugins for the Xfce panel" "Multimedia support for Xfce" "Xfce Office" +``` + +#### **[xmonad][38]** + +``` +A tiling window manager + dnf install xmonad + (optional) dnf install xmonad-mate +``` + +* * * + +_Photo by [Annie Spratt][39] on [Unsplash][40]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedoras-gaggle-of-desktops/ + +作者:[Troy Dawson][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/tdawson/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/gaggle-desktops-816x345.jpg +[2]: https://github.com/9wm/9wm +[3]: https://awesomewm.org/ +[4]: https://github.com/bbidulock/blackboxwm +[5]: https://github.com/baskerville/bspwm +[6]: https://byobu.org/ +[7]: https://github.com/linuxmint/cinnamon +[8]: https://github.com/leahneukirchen/cwm +[9]: https://www.deepin.org/en/dde/ +[10]: http://dwm.suckless.org/ +[11]: https://www.enlightenment.org/ +[12]: http://fluxbox.org/ +[13]: https://github.com/fvwmorg/fvwm +[14]: https://www.gnome.org/ +[15]: http://herbstluftwm.org/ +[16]: https://i3wm.org/ +[17]: https://ice-wm.org/ +[18]: http://joewing.net/projects/jwm/ +[19]: https://kde.org/ +[20]: https://lumina-desktop.org/ +[21]: https://lxde.org/ +[22]: https://lxqt.org/ +[23]: https://mate-desktop.org/ +[24]: https://github.com/enticeing/musca +[25]: http://openbox.org +[26]: https://elementary.io/ +[27]: http://www.pekwm.org/ +[28]: http://qtile.org +[29]: http://www.nongnu.org/ratpoison/ +[30]: http://sawfish.wikia.com/ +[31]: https://github.com/conformal/spectrwm +[32]: https://sugarlabs.org/ +[33]: https://github.com/swaywm/sway +[34]: https://www.x.org/releases/X11R7.6/doc/man/man1/twm.1.xhtml +[35]: http://www.windowmaker.org +[36]: http://www.all-day-breakfast.com/wmx/ +[37]: https://www.xfce.org/ +[38]: https://hackage.haskell.org/package/xmonad +[39]: https://unsplash.com/@anniespratt?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[40]: https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From 0b2183cb55f3cd4014954ff38357691a09d62d87 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 29 Feb 2020 01:01:50 +0800 Subject: [PATCH 132/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200227=20How=20?= =?UTF-8?q?Melissa=20Di=20Donato=20Is=20Going=20To=20Reinvent=20SUSE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md --- ...ssa Di Donato Is Going To Reinvent SUSE.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/tech/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md diff --git a/sources/tech/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md b/sources/tech/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md new file mode 100644 index 0000000000..eb5fa59eb0 --- /dev/null +++ b/sources/tech/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Melissa Di Donato Is Going To Reinvent SUSE) +[#]: via: (https://www.linux.com/articles/how-melissa-di-donato-is-going-to-reinvent-suse/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +How Melissa Di Donato Is Going To Reinvent SUSE +====== + +[![][1]][2] + +[![][1]][2] + +SUSE is one of the oldest open source companies and the first to market Linux for the enterprise. Even though it has undergone several acquisitions and a merger, it remains a strong player in the business. It has maintained its integrity and core values around open source. It continues to rely on its tried-and-tested Linux business and European markets, and generally shies away from making big moves taking big risks. + +Until now. + +[SUSE appointed Melissa Di Donato as its first female CEO][3]. She is making some serious changes to the company, from building a diverse and inclusive culture to betting on emerging technologies and taking risks. + +Soon after taking the helm last year, Di Donato spent the first few months traveling around the globe to meet SUSE teams and customers and get a better sense of the perception of the market about the company. + +Just like [Red Hat CEO Jim Whitehurst,][4] Di Donato didn’t come to the company from an open source background. She had spent the last 25 years of her career as a SUSE customer, so she did have an outsider’s perspective of the company. + +“I am not interested in what SUSE was when I joined. I am more interested in what we want to become,” she said. + +**Innovating for customers** + +After her 100-day global tour, Di Donato had a much clearer picture of the company. She found that more than 80% of SUSE customers were still traditionalists, i.e., companies such as Walgreens and Daimler who have been around for a long time. + +Over the years, these customers brought technologies into their environments to simplify things, but they ended up creating more complexities. It’s a tall order to weave through the legacy technical debt they incurred and embrace emerging technologies such as Cloud Foundry, Kubernetes and so on. + +These customers want to modernize their legacy environments and workloads, but they can’t do that with the complex environments they have built. They can’t iterate faster; they can’t respond to new opportunities and new competitors faster. + +They want to leverage cloud-native technologies like Kubernetes and containers, but it is overwhelming to evaluate technologies that are emerging at such a rapid pace. Which ones are just shiny new things and which ones do they really need them to accelerate their business goals? + +“We have to help our customers simplify their infrastructure and environment so that they can start modernizing it and start leveraging new technologies,” Di Donato said. + +While SUSE will continue to focus on core Linux OS, it will also invest in the next generation of Linux. It has been working on technologies like Kubic and MicroOS that change the way Linux is installed, managed, and operated. + +She explains, “We are going to reinvent the way operating systems are used. We are going to make sure that we provide solutions that help our customers optimize their environment, automate components to help the applications run in a much more efficient and modern way. That’s what SUSE is going to be — an innovator. We’re not there quite yet, but that’s our focus.”. + +**Evolving the company ** + +Historically, SUSE has been a fairly conservative company compared to other companies like Red Hat, which has been embracing emerging technologies at a much faster rate than any other open source software vendor. + +“We have not been in a place where we’ve been considered the risk taker. We’re the steady, stable provider of the most comprehensive unbreakable solutions in the market,” Di Donato admitted. “But we need to take that strong foundation and begin to become a bit of a risk taker, and begin to become very innovative.” + +She is also gunning for explosive growth. “We’re going to double in size by 2023. We have to go from just under half-a-billion in revenue to a billion.” + +To achieve that, SUSE will be looking at both organic and inorganic growth, including acquisition of companies, talent and technologies. “We are going to be the default choice for innovation. We are going to be the default choice for highly innovative technologies that really change the landscape,” Di Donato said. + +**Refining the brand** + +Aside from making significant changes within the company, Di Donato is working on refining the SUSE brand. She hired seasoned Ivo Totev to lead Product and Marketing and showcase the company’s differentiation. + +“We’re trying to get into the psychology of reinventing the brand,” Di Donato said. Her goal is to allocate 30-40% of SUSE’s total revenue outside of the core Linux OS towards emerging markets and develop the technologies that they’ve already built. + +SUSE _is_ home to many innovative technologies that are being used by other open source communities, even its competitors. It just didn’t market them the way Red Hat would market its technologies and projects. Even though SUSE started before Red Hat, the latter has much more visibility around the globe. + +“It’s a matter of getting the word out. We build things, but we don’t talk about it or do anything about it. We actually have to put a package around it and start selling it so people can see who we are and what value we bring to them.” + +In Di Donato’s eyes, though, good marketing isn’t everything. She argued that customers are going to demand flexibility and they are going to demand innovation that is not tied to the stack of a company. “Red Hat has a very locked-in stack that doesn’t allow them to be agnostic at all.” + +It’s quite true that unlike Red Hat, SUSE is known as an “open open-source company”, one that believes in working with partners to create an ecosystem around open source, instead of creating a tightly integrated stack that locks everyone out. + +She believes that eventually, customers would want the freedom and flexibility of picking and choosing the components they want in their stack. + +**Conclusion** + +Expect some big moves from SUSE in the near future. Less than a year into the company, new CEO Di Donato has developed a very clear vision. “We’re going to build this company based on an innovative and agile mindset. We’re not going to give up the stability and the quality of our core. What we are going to do is surround the core with really innovative thought-leading technologies that are going to set us apart from our competition… You are going to feel and experience a very different sense of excitement because we’re going to be talking much, much louder than we’ve ever talked about it before.” + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/how-melissa-di-donato-is-going-to-reinvent-suse/ + +作者:[Swapnil Bhartiya][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/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2020/02/Melissa-Di-Donato-1068x763.jpg (Melissa Di Donato) +[2]: https://www.linux.com/wp-content/uploads/2020/02/Melissa-Di-Donato-scaled.jpg +[3]: https://www.tfir.io/suse-gets-its-first-female-ceo-melissa-di-donato/ +[4]: https://www.cio.com/article/3090140/jim-whitehurst-if-its-important-to-the-linux-community-its-important-to-red-hat.html From f513b255ef9fcce40917f1311436b205f5bede02 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 29 Feb 2020 01:02:45 +0800 Subject: [PATCH 133/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200229=20Solus?= =?UTF-8?q?=20Linux=20Creator=20Ikey=20Doherty=20Enters=20the=20Game=20Dev?= =?UTF-8?q?=20Business=20With=20a=20New=20Open=20Source=20Game=20Engine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md --- ...ness With a New Open Source Game Engine.md | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 sources/tech/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md diff --git a/sources/tech/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md b/sources/tech/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md new file mode 100644 index 0000000000..a61dfca27f --- /dev/null +++ b/sources/tech/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine) +[#]: via: (https://itsfoss.com/ikey-doherty-serpent-interview/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine +====== + +[Ikey Doherty][1], the creator and former lead dev of [Solus][2], is back with a new project. His new company, [Lispy Snake, Ltd][3], uses open source technology to create games, with a focus on Linux support. + +I asked Ikey some questions about his new project. Here are his answers. + +![][4] + +_**It’s FOSS: What made you decide to get into game development?**_ + +**Ikey**: Honestly I would have to say a respect for older games. The creativity that came from so much limitation is frankly amazing. If you think of how limited the NES or C64 were, (or indeed my [Amstrad CPC][5]) – yet how much joy people experienced from those platforms. It’s a buzz I can’t avoid. Even though we’re a long way now from that world, I still look to model that technical excellence and creativity as best I can. I’m a sucker for good stories. + +_**It’s FOSS: There are already several open-source game engines. Why did you decide to make your own? What is Serpent’s killer feature?**_ + +**Ikey**: There are a good number of open and closed source ones, each with a great set of features. However, I’m a pretty old school developer and there is nothing I hate more than an IDE or ‘drag n drop’ codeless environment. I simply wanted to create indie games with the least fuss possible and using a framework where I didn’t have to compromise. Once you get to ‘must work nicely on Linux and be open source’ you’re kinda short on choice. + +I collected a set of projects that I’d use as the foundation for Lispy Snake’s first games, but needed something of a framework to tie them all together, as a reusable codebase across all games and updates. + +I wouldn’t say killer features are present yet – just a set of sensible decisions. Serpent is written in D so it’s highly performant with a lower barrier of entry than say C or C++. It’s allowing me to flesh out a framework that suits my development ideals and pays attention to industry requirements, such as a performant multithreading Entity Component System or the sprite batching system. + +When you rope together all the features and decisions, you get a portable codebase, that thanks to its choice of libraries like SDL and bgfx, will eventually run on all major platforms with minimal effort on our part. That basically means we’re getting OpenGL, DirectX, Vulkan and Metal “for free”. + +Being able to target the latest APIs and create indie games easily, with industry standard features emerging constantly, from a framework that doesn’t impose itself on your workflow…that’s a pretty good combination. + +![][6] + +_**It’s FOSS: Why did you name your company LispySnake? Did you have a pet snake with a speech impediment when you were a kid?**_ + +**Ikey**: Honestly? [Naughty Dog][7] was taken. Gotta love some Bandicoot. Plus, originally we were taking on some Python contracting work and I found the name amusing. It’s pretty much a nonsensical name like many of my previous projects (Like Dave. Or Dave2.) + +_**It’s FOSS: After being an operating system developer for many years, how does it feel to be working on something smaller? Would you say that your time as an OS developer gives you an edge as a game dev?**_ + +**Ikey**: OS dev needs a very high level view constantly, with the ability to context switch from macro to micro and back again. Many, many moving parts in a large ecosystem. + +Serpent is much more task orientated – though similarities in the workflow exist in terms of defining macro systems and interleaving micro features to build a cohesive whole. My background in OS dev is obviously a huge help here. + +Where it especially shines is dealing with the ‘guts’. I think a lot of indie devs (forgive me for being sweeping) are generally happy to just build from an existing kit and either embrace it or workaround the issues. There are some true gems out there like Factorio that go above and beyond and I have to hold my hat to them. + +In terms of building a new kit we get to think, properly, about cache coherency, parallel performance, memory fragmentation, context switching and such. + +Consumers of Serpent (when released in a more stable form) will know that the framework has been designed to leverage Linux features, not just spitting out builds for it. + +![][8] + +_**It’s FOSS: Recently you ported your [Serpent][9] game engine from C to the [D language][10]. Why did you make this move? What features does D have over C?**_ + +**Ikey**: Yeah honestly that was an interesting move. We were originally working on a project called lispysnake2d which was to be a trivial wrapper around SDL to give us a micro-game library. This simply used SDL_Renderer APIs to blit 2D sprites and initially seemed sufficient. Unfortunately as development progressed it was clear we needed a 3D pipeline for 2D, so we could utilize shaders and special effects. At that point SDL_Renderer is no good to you anymore and you need to go with Vulkan or OpenGL. We began abstracting the pipelines and saw the madness ensue. + +After taking a step back, I analyzed all the shortcomings in the approach, and tired of the portability issues that would definitely arise. I’m not talking in terms of libraries, I’m talking about dealing with various filepaths, encodings, Win32 APIs, DirectX vs OpenGL vs Vulkan…etc. Then whack in boilerplate time, C string shortcomings, and the amount of reinventing required to avoid linking to bloated “cross-platform” standard library style libraries. It was a bad picture. + +Having done a lot of [Go][11] development, I started researching alternatives to C that were concurrency-aware, string-sane, and packed with a powerful cross-platform standard library. This is the part where everyone will automatically tell you to use Rust. + +Unfortunately, I’m too stupid to use [Rust][12] because the syntax literally offends my eyes. I don’t get it, and I never will. Rust is a fantastic language and as academic endeavours go, highly successful. Unfortunately, I’m too practically minded and seek comfort in C-style languages, having lived in that world too long. So, D was the best candidate to tick all the boxes, whilst having C & C++ interoptability. + +It took us a while to restore feature parity but now we have a concurrency-friendly framework which is tested with both OpenGL and Vulkan, supports sprite batching and has nice APIs. Plus, much of the reinvention is gone as we’re leveraging all the features of SDL, bgfx and the DLang standard library. Win win. + +![The first game from LispySnake][13] + +_**It’s FOSS: How are you planning to distribute your games?**_ + +**Ikey**: Demo wise we’ll initially only focus on Linux, and it’s looking like we’ll use Flatpak for that. As time goes on, when we’ve introduced support and testing for macOS + Windows, we’ll likely look to the Steam Store. Despite the closed source nature, Valve have been far more friendly and supportive of Linux over the years, whilst the likes of Epic Games have a long history of being highly anti-Linux. So that’s a no go. + +_**It’s FOSS: How can people support and contribute to the development of the Serpent game engine?**_ + +**Ikey**: We have a few different methods, for what it’s worth. The easiest is to [buy a Lifetime License][14] – which is $20. This grants you lifetime access to all of our 2D games and helps fund development of our game titles and Serpent. + +Alternatively, you can [sponsor me directly on GitHub][15] to work on Serpent and upstream where needed. Bit of FOSS love. + +[Support with Lifetime License][16] + +[Sponsor the development on GitHub][15] + +* * * + +I would like to thank Ikey for taking the time to answer my questions about his latest project. + +Have any of you created a game with open source tools? If so, what tools and how was the experience? Please 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][17]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ikey-doherty-serpent-interview/ + +作者:[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://twitter.com/ikey_doherty +[2]: https://getsol.us/home/ +[3]: https://lispysnake.com/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/ikey_doherty_serpent_interview.png?ssl=1 +[5]: https://en.wikipedia.org/wiki/Amstrad_CPC +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/lipsy_snake_screenshot.png?ssl=1 +[7]: https://www.naughtydog.com/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/lipsy_snake.png?ssl=1 +[9]: https://github.com/lispysnake/serpent +[10]: https://dlang.org/ +[11]: https://golang.org/ +[12]: https://www.rust-lang.org/ +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/last_peacekeeper_game.png?ssl=1 +[14]: https://lispysnake.com/the-game-raiser/ +[15]: https://github.com/sponsors/ikeycode +[16]: https://lispysnake.com/the-game-raiser +[17]: https://reddit.com/r/linuxusersgroup From 8396b2482b57da9a4a7235813a52ae60bb2df1a7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 29 Feb 2020 01:04:05 +0800 Subject: [PATCH 134/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200228=20How=20?= =?UTF-8?q?to=20process=20real-time=20data=20with=20Apache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200228 How to process real-time data with Apache.md --- ...w to process real-time data with Apache.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/tech/20200228 How to process real-time data with Apache.md diff --git a/sources/tech/20200228 How to process real-time data with Apache.md b/sources/tech/20200228 How to process real-time data with Apache.md new file mode 100644 index 0000000000..7bf16741b4 --- /dev/null +++ b/sources/tech/20200228 How to process real-time data with Apache.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to process real-time data with Apache) +[#]: via: (https://opensource.com/article/20/2/real-time-data-processing) +[#]: author: (Simon Crosby https://opensource.com/users/simon-crosby) + +How to process real-time data with Apache +====== +Open source is leading the way with a rich canvas of projects for +processing real-time events. +![Alarm clocks with different time][1] + +In the "always-on" future with billions of connected devices, storing raw data for analysis later will not be an option because users want accurate responses in real time. Prediction of failures and other context-sensitive conditions require data to be processed in real time—certainly before it hits a database. + +It's tempting to simply say "the cloud will scale" to meet demands to process streaming data in real time, but some simple examples show that it can never meet the need for real-time responsiveness to boundless data streams. In these situations—from mobile devices to IoT—a new paradigm is needed. Whereas cloud computing relies on a "store then analyze" big data approach, there is a critical need for software frameworks that are comfortable instantly processing endless, noisy, and voluminous streams of data as they arrive to permit a real-time response, prediction, or insight. + +For example, the city of Palo Alto, Calif. produces more streaming data from its traffic infrastructure per day than the Twitter Firehose. That's a lot of data. Predicting city traffic for consumers like Uber, Lyft, and FedEx requires real-time analysis, learning, and prediction. Event processing in the cloud leads to an inescapable latency of about half a second per event. + +We need a simple yet powerful programming paradigm that lets applications process boundless data streams on the fly in these and similar situations: + + * Data volumes are huge, or moving raw data is expensive. + * Data is generated by widely distributed assets (such as mobile devices). + * Data is of ephemeral value, and analysis can't wait. + * It is critical to always have the latest insight, and extrapolation won't do. + + + +### Publish and subscribe + +A key architectural pattern in the domain of event-driven systems is the concept of pub/sub or publish/subscribe messaging. This is an asynchronous communication method in which messages are delivered from _publishers_ (anything producing data) to *subscribers (*applications that process data). Pub/sub decouples arbitrary numbers of senders from an unknown set of consumers. + +In pub/sub, sources _publish_ events for a _topic_ to a _broker_ that stores them in the order in which they are received. An application _subscribes_ to one or more _topics_, and the _broker_ forwards matching events. Apache Kafka and Pulsar and CNCF NATS are pub/sub systems. Cloud services for pub/sub include Google Pub/Sub, AWS Kinesis, Azure Service Bus, Confluent Cloud, and others. + +Pub/sub systems do not _run_ subscriber applications—they simply _deliver_ data to topic subscribers. + +Streaming data often contains events that are updates to the state of applications or infrastructure. When choosing an architecture to process data, the role of a data-distribution system such as a pub/sub framework is limited. The "how" of the consumer application lies beyond the scope of the pub/sub system. This leaves an enormous amount of complexity for the developer to manage. So-called stream processors are a special kind of subscriber that analyzes data on the fly and delivers results back to the same broker. + +### Apache Spark + +[Apache Spark][2] is a unified analytics engine for large-scale data processing. Often, Apache Spark Streaming is used as a stream processor, for example, to feed machine learning models with new data. Spark Streaming breaks data into mini-batches that are each independently analyzed by a Spark model or some other system. The stream of events is grouped into mini-batches for analysis, but the stream processor itself must be elastic: + + * The stream processor must be capable of scaling with the data rate, even across servers and clouds, and also balance load across instances, ensuring resilience and other application-layer needs. + * It must be able to analyze data from sources that report at widely different rates, meaning it must be stateful—or store state in a database. This latter approach is often used when Spark Streaming is used as the stream processor and can cause performance problems when ultra-low latency responses are needed. + + + +A related project, [Apache Samza][3], offers a way to process real-time event streams, and to scale elastically using [Hadoop Yarn][4] or [Apache Mesos][5] to manage compute resources. + +### Solving the problem of scaling data + +It's important to note that even Samza cannot entirely alleviate data processing demands for the application developer. Scaling data rates mean that tasks to process events need to be load-balanced across many instances, and the only way to share the resulting application-layer state between instances is to use a database. However, the moment state coordination between tasks of an application devolves to a database, there is an inevitable knock-on effect upon performance. Moreover, the choice of database is crucial. As the system scales, cluster management for the database becomes the next potential bottleneck. + +This can be solved with alternative solutions that are stateful, elastic, and can be used in place of a stream processor. At the application level (within each container or instance), these solutions build a stateful model of concurrent, interlinked "web agents" on the fly from streaming updates. Agents are concurrent "nano-services" that consume raw data for a single source and maintain their state. Agents interlink to share state based on real-world relationships between sources found in the data, such as containment and proximity. Agents thus form a graph of concurrent services that can analyze their own state and the states of agents to which they are linked. Each agent provides a nano-service for a single data source that converts from raw data to state and analyzes, learns, and predicts from its own changes and those of its linked subgraph. + +These solutions simplify application architecture by allowing agents—digital twins of real-world sources—to be widely distributed, even while maintaining the distributed graph that interlinks them at the application layer. This is because the links are URLs that map to the current runtime execution instance of the solution and the agent itself. In this way, the application seamlessly scales across instances without DevOps concerns. Agents consume data and maintain state. They also compute over their own state and that of other agents. Because agents are stateful, there is no need for a database, and insights are computed at memory speed. + +### Reading world data with open source + +There is a sea change afoot in the way we view data: Instead of the database being the system of record, the real world is, and digital twins of real-world things can continuously stream their state. Fortunately, the open source community is leading the way with a rich canvas of projects for processing real-time events. From pub/sub, where the most active communities are Apache Kafka, Pulsar, and CNCF NATS, to the analytical frameworks that continually process streamed data, including Apache Spark, [Flink][6], [Beam][7], Samza, and Apache-licensed [SwimOS][8] and [Hazelcast][9], developers have the widest choices of software systems. Specifically, there is no richer set of proprietary software frameworks available. Developers have spoken, and the future of software is open source. + +Introduction to Apache Hadoop, an open source software framework for storage and large scale... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/real-time-data-processing + +作者:[Simon Crosby][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/simon-crosby +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/clocks_time.png?itok=_ID09GDk (Alarm clocks with different time) +[2]: https://spark.apache.org/ +[3]: https://samza.apache.org/ +[4]: https://hadoop.apache.org/ +[5]: http://mesos.apache.org/ +[6]: https://flink.apache.org/ +[7]: https://beam.apache.org +[8]: https://github.com/swimos/swim +[9]: https://hazelcast.com/ From 668e3a1e8b9db7eb73cdcdeaeade068b539de720 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 29 Feb 2020 01:04:54 +0800 Subject: [PATCH 135/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200228=20Revive?= =?UTF-8?q?=20your=20RSS=20feed=20with=20Newsboat=20in=20the=20Linux=20ter?= =?UTF-8?q?minal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200228 Revive your RSS feed with Newsboat in the Linux terminal.md --- ...eed with Newsboat in the Linux terminal.md | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 sources/tech/20200228 Revive your RSS feed with Newsboat in the Linux terminal.md diff --git a/sources/tech/20200228 Revive your RSS feed with Newsboat in the Linux terminal.md b/sources/tech/20200228 Revive your RSS feed with Newsboat in the Linux terminal.md new file mode 100644 index 0000000000..27a8d6ecbd --- /dev/null +++ b/sources/tech/20200228 Revive your RSS feed with Newsboat in the Linux terminal.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Revive your RSS feed with Newsboat in the Linux terminal) +[#]: via: (https://opensource.com/article/20/2/newsboat) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Revive your RSS feed with Newsboat in the Linux terminal +====== +Newsboat is an excellent RSS reader, whether you need a basic set of +features or want your application to do a whole lot more. +![Boat on the ocean with Creative Commons sail][1] + +Psst. Word on the web is that RSS died in 2013. That's when Google pulled the plug on Google Reader. + +Don't believe everything that you hear. RSS is alive. It's well. It's still a great way to choose the information you want to read without algorithms making the decision for you. All you need is the [right feed reader][2]. + +Back in January, Opensource.com Correspondent [Kevin Sonney][3] introduced a nifty terminal RSS reader [called Newsboat][4]. In his article, Kevin scratched Newsboat's surface. I figured it was time to take a deeper dive into what Newsboat can do. + +### Adding RSS feeds to Newsboat + +As Kevin writes, "installing Newsboat is pretty easy since it is included with most distributions (and Homebrew on macOS)." You can, as Kevin also notes, import a [file containing RSS feeds][5] from another reader. If this is your first kick at the RSS can or it's been a while since you've used an RSS reader, chances are you don't have one of those files handy. + +Not to worry. You just need to do some copying and pasting. Go to the folder **.newsboat** in your **/home** directory. Once you're there, open the file **urls** in a text editor. Then, go to the websites you want to read, find the links to their RSS feeds, and copy and paste them into the **urls** file. + +![Newsboat urls file][6] + +Start Newsboat, and you're ready to get reading. + +### Reading your feeds + +As Kevin Sonney points out, you refresh your feeds by pressing the **r** or **R** keys on your keyboard. To read the articles from a feed, press **Enter** to open that feed and scroll down the list. Then, press **Enter** to read an item. + +![Newsboat reading][7] + +Return to the list of articles by pressing **q**. Press **q** again to return to your list of feeds. + +Every so often, you might run into a feed that shows just part of an article. That can be annoying. To get the full article, press **o** to open it in your desktop's default web browser. On my desktop, for example, that's Firefox. You can change the browser Newsboat works with; I'll explain that below. + +### Following links + +Hyperlinking has been a staple of the web since its beginnings at CERN in the early 1990s. It's hard to find an article published online that doesn't contain at least a couple of links that point elsewhere. + +Instead of leaving links embedded in an article or post, Newsboat gathers them into a numbered list at the end of the article or post. + +![Hyperlinks in Newsboat][8] + +To follow a link, press the number beside it. In the screenshot above, you'd press **4** to open the link to the homepage of one of the contributors to that article. The link, as you've probably guessed, opens in your default browser. + +### Using Newsboat as a client for other feed readers + +You might use a web-based feed reader, but might also want to read your RSS feeds in something a bit more minimal on your desktop. Newsboat can do that. + +It works with several feed readers, including The Old Reader, Inoreader, Newsblur, Tiny Tiny RSS, FeedHQ, and the newsreader apps for [ownCloud][9] and [Nextcloud][10]. Before you can read feeds from any of them, you'll need to do a little work. + +Go back to the **.newsboat** folder in your **/home** directory and create a file named **config**. Then add the settings that hook Newsboat into one of the RSS readers it supports. You can find more information about the specific settings for each reader in [Newsboat's documentation][11]. + +Here's an example of the settings I use to connect Newsboat with the newsreader app in my instance of Nextcloud: + + +``` +urls-source "ocnews" +ocnews-url "" +ocnews-login "myUserName" +ocnews-password "NotTellingYouThat!" +``` + +I've tested this with Nextcloud, The Old Reader, Inoreader, and Newsblur. Newsboat worked seamlessly with all of them. + +![Newsboat with The Old Reader][12] + +### Other useful configuration tricks + +You can really unleash Newsboat's power and flexibility by tapping into [its configuration options][13]. That includes changing text colors, the order Newsboat sorts feeds, where it saves articles, the length of time Newsboat keeps articles, and more. + +Below are a few of the options I've added to my configuration file. + +#### Change Newsboat's default browser + +As I mentioned a few paragraphs back, Newsboat opens articles in your default graphical web browser. If you want to read feeds in a [text-only browser][14] like w3m or ELinks, add this to your Newsboat configuration file: + + +``` +`browser "/path/to/browser %u"` +``` + +In my configuration file, I've set w3m up as my browser: + + +``` +`browser "/usr/bin/w3m %u"` +``` + +![Newsboat with w3m][15] + +#### Remove read articles + +I like an uncluttered RSS feed. That means getting rid of articles I've already read. Add this setting to the configuration file to have Newsboat do that automatically: + + +``` +`show-read-feeds  no` +``` + +#### Refresh feeds at launch + +Life gets busy. Sometimes, I go a day or two without checking my RSS feeds. That means having to refresh them after I fire Newsboat up. Sure, I can press **r** or **R**, but why not have the application do it for me? I've added this setting to my configuration file to have Newsboat refresh all of my feeds when I launch it: + + +``` +`refresh-on-startup  yes` +``` + +If you have a lot of feeds, it can take a while to refresh them. I have around 80 feeds, and it takes over a minute to get new content from all of them. + +### Is that everything? + +Not even close. In addition to all of its configuration options, Newsboat also has a number of command-line switches you can use when you fire it up. Read more about them in the [documentation][16]. + +On the surface, Newsboat is simple. But a lot of power and flexibility hides under its hood. That makes Newsboat an excellent RSS reader for anyone who needs a basic set of features or for someone who needs their RSS reader to do a whole lot more. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/newsboat + +作者:[Scott Nesbitt][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/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/CreativeCommons_ideas_520x292_1112JS.png?itok=otei0vKb (Boat on the ocean with Creative Commons sail) +[2]: https://opensource.com/article/17/3/rss-feed-readers +[3]: https://opensource.com/users/ksonney +[4]: https://opensource.com/article/20/1/open-source-rss-feed-reader +[5]: https://en.wikipedia.org/wiki/OPML +[6]: https://opensource.com/sites/default/files/uploads/newsboat-urls-file.png (Newsboat urls file) +[7]: https://opensource.com/sites/default/files/uploads/newsboat-reading.png (Newsboat reading) +[8]: https://opensource.com/sites/default/files/uploads/newsboat-links.png (Hyperlinks in Newsboat) +[9]: https://github.com/owncloudarchive/news +[10]: https://github.com/nextcloud/news +[11]: https://newsboat.org/releases/2.18/docs/newsboat.html#_newsboat_as_a_client_for_newsreading_services +[12]: https://opensource.com/sites/default/files/uploads/newsboat-oldreader.png (Newsboat with The Old Reader) +[13]: https://newsboat.org/releases/2.18/docs/newsboat.html#_example_configuration +[14]: https://opensource.com/article/16/12/web-browsers-linux-command-line +[15]: https://opensource.com/sites/default/files/uploads/newsboat-read-with-w3m.png (Newsboat with w3m) +[16]: https://newsboat.org/releases/2.18/docs/newsboat.html From 326eff472a6031364315642d540e388e846deacb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 29 Feb 2020 01:05:34 +0800 Subject: [PATCH 136/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200228=20Gettin?= =?UTF-8?q?g=20started=20with=20Linux=20firewalls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200228 Getting started with Linux firewalls.md --- ...28 Getting started with Linux firewalls.md | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 sources/tech/20200228 Getting started with Linux firewalls.md diff --git a/sources/tech/20200228 Getting started with Linux firewalls.md b/sources/tech/20200228 Getting started with Linux firewalls.md new file mode 100644 index 0000000000..c77d60b618 --- /dev/null +++ b/sources/tech/20200228 Getting started with Linux firewalls.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Linux firewalls) +[#]: via: (https://opensource.com/article/20/2/firewall-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Getting started with Linux firewalls +====== +A firewall is your computer's first line of defense against network +intrusion. Download our cheat sheet to make sure you're secure. +![Cheat Sheet cover image][1] + +A sensible firewall is your computer's first line of defense against network intrusion. When you're at home, you're probably behind a firewall built into the router supplied by your internet service provider. When you're away from home, though, the only firewall you have is the one running on your computer, so it's important to configure and control the firewall on your Linux computer. If you run a Linux server, it's just as important to know how to manage your firewall so that you can protect it from unwanted traffic both locally and remotely. + +### Install a firewall + +Many Linux distributions ship with a firewall already installed, and traditionally that was **iptables**. It is extremely effective and customizable, but it can be complex to configure. Luckily, developers have produced several frontends to help users control their firewall without writing lengthy iptables rules. + +On Fedora, CentOS, Red Hat, and similar distributions, the firewall software installed by default is **firewalld**, which is configured and controlled with the **firewall-cmd** command. On Debian and most other distributions, firewalld is available to install from your software repository. Ubuntu ships with the Uncomplicated Firewall (ufw), so to use firewalld, you must enable the **universe** repository: + + +``` +$ sudo add-apt-repository universe +$ sudo apt install firewalld +``` + +You must also deactivate ufw: + + +``` +`$ sudo systemctl disable ufw` +``` + +There's no reason _not_ to use ufw. It's an excellent firewall frontend. However, this article focuses on firewalld because of its wide availability and integration into systemd, which is shipped with nearly every distribution. + +Regardless of your distribution, for a firewall to be effective, it must be active, and it should be loaded at boot time: + + +``` +`$ sudo systemctl enable --now firewalld` +``` + +### Understanding firewall zones + +Firewalld aims to make firewall configuration as simple as possible. It does this by establishing _zones_. A zone is a set of sensible, common rules that suit the everyday needs of most users. There are nine by default: + + * **trusted:** All network connections are accepted. This is the least paranoid firewall setting and should only be used in a trusted environment, such as a test lab or in a family home where everyone on the local network is known to be friendly. + * **home, work, internal:** In these three zones, most incoming connections are accepted. They each exclude traffic on ports that usually expect no activity. Any of them is a reasonable setting for use in a home setting where there is no reason to expect network traffic to obscure ports, and you generally trust the other users on the network. + * **public:** For use in public areas. This is a paranoid setting, intended for times when you do not trust other computers on the network. Only selected common and mostly safe incoming connections are accepted. + * **dmz:** DMZ stands for demilitarized zone. This zone is intended for computers that are publically accessible, located on an organization's external network with limited access to the internal network. For personal computers, this is usually not a useful zone, but it is an important option for certain types of servers. + * **external:** For use on external networks with masquerading enabled (meaning the addresses of your private network are mapped to and hidden behind a public IP address). Similar to the dmz zone, only selected incoming connections are accepted, including SSH. + * **block:** Only network connections initiated within this system are possible, and all incoming network connections are rejected with an **icmp-host-prohibited** message. This is an extremely paranoid setting and is an important option for certain types of servers or personal computers in an untrusted or hostile environment. + * **drop:** Any and all incoming network packets are dropped with no reply. Only outgoing network connections are possible. The only setting more paranoid than this one is turning off your WiFi and unplugging your Ethernet cable. + + + +You can read about each zone and any other zones defined by your distribution or sysadmin by looking at the configuration files in **/usr/lib/firewalld/zones**. For instance, here's the FedoraWorkstation zone that ships with Fedora 31: + + +``` +$ cat /usr/lib/firewalld/zones/FedoraWorkstation.xml +<?xml version="1.0" encoding="utf-8"?> +<zone> +  <short>Fedora Workstation</short> +  <description>Unsolicited incoming network packets are rejected from port 1 to 1024, except for select network services. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed.</description> +  <service name="dhcpv6-client"/> +  <service name="ssh"/> +  <service name="samba-client"/> +  <port protocol="udp" port="1025-65535"/> +  <port protocol="tcp" port="1025-65535"/> +</zone> +``` + +### Getting your current zone + +You can see what zone you're in at any time with the **\--get-active-zones** option: + + +``` +`$ sudo firewall-cmd --get-active-zones` +``` + +In response, you receive the name of the active zone along with the network interface assigned to it. On a laptop, that usually means you have a WiFi card in the default zone: + + +``` +FedoraWorkstation +  interfaces: wlp61s0 +``` + +### Change your current zone + +To change your zone, reassign your network interface to a different zone. For instance, to change the example **wlp61s0** card to the public zone: + + +``` +$ sudo firewall-cmd --change-interface=wlp61s0 \ +\--zone=public +``` + +You can change the active zone for an interface any time you please and for any reason—whether you're going out to a café and feel the need to increase your laptop's security policy, or you're going to work and need to open up some ports to get on the intranet, or for any other reason. The options for **firewall-cmd** auto-complete when you press the **Tab** key, so as long as you remember the keywords "change" and "zone," you can stumble through the command until you learn it by memory. + +### Learn more + +There's a lot more you can do with your firewall, including customizing existing zones, setting a default zone, and more. The more comfortable with firewalls you get, the more secure your online activities are, so we've created a [cheat sheet][2] for quick and easy reference. + +### Download your [firewall cheat sheet][2] + +David Both shares how he replaced his dedicated network firewall computer with a Raspberry Pi 2. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/firewall-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://opensource.com/downloads/firewall-cmd-cheat-sheet From 51cacd4975666515c89f6873b608ac6eb7499a89 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 29 Feb 2020 01:06:19 +0800 Subject: [PATCH 137/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200228=204=20te?= =?UTF-8?q?chnologists=20on=20careers=20in=20tech=20for=20minorities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200228 4 technologists on careers in tech for minorities.md --- ...gists on careers in tech for minorities.md | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sources/tech/20200228 4 technologists on careers in tech for minorities.md diff --git a/sources/tech/20200228 4 technologists on careers in tech for minorities.md b/sources/tech/20200228 4 technologists on careers in tech for minorities.md new file mode 100644 index 0000000000..806300d5db --- /dev/null +++ b/sources/tech/20200228 4 technologists on careers in tech for minorities.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 technologists on careers in tech for minorities) +[#]: via: (https://opensource.com/article/20/2/careers-tech-minorities) +[#]: author: (Shilla Saebi https://opensource.com/users/shillasaebi) + +4 technologists on careers in tech for minorities +====== +Learn what Black History Month means to them, what influences their +career, resources for minorities wanting to break into tech, and more. +![Team meeting][1] + +In honor of Black History Month, I've garnered the opinions of a few of my favorite technology professionals and open source contributors. These four individuals are paving the way for the next generation alongside the work they're doing in the technology industry. Learn what Black History Month means to them, what influences their career, resources for minorities wanting to break into tech, and more. + +**[Tameika Reed][2], founder of Women In Linux** + +Since its launch, Tameika leads initiatives with a focus on exploring careers in infrastructure, cybersecurity, DevOps and IoT, pivoting into leadership and continuous skill-building. As a self-taught system administrator, Tameika believes the best way to learn tech is by just diving in. In efforts to give women a 360° view of tech, Tameika hosts a weekly virtual meetup to explore outside the norm of just Linux but introducing hyperledger, Kubernetes, microservices, and high-performance computing. Tameika’s career includes different conference talks from OSCon, LISA 2018, Seagl, HashiCorp EU 2019, and various local events. + +**[Michael Scott Winslow][3], Director, Core Applications and Platforms, Comcast** + +"I'm a father, husband, brother, and son. I come from a small family so I have fun turning friends into an extended family. When I attach my name to something, I obsess over its success, so I am very careful what I agree to be a part of. Oh, so as far as my career I have been involved with software development for decades. I solve problems. I work with others to help solve large problems. I lead, guide and mentor newer software engineers while observing others that I want to learn from." + +**[Bryan Liles][4], senior staff engineer, VMware** + +"I’m working with our team to rethink how developers interact with Kubernetes. When not working, I’m out in the community trying to inspire the next generation of software engineers and building robots." + +**[Mutale Nkonde][5], founding CEO of AI For the People (AFP)** + +AFP is a nonprofit creative agency. Prior to starting a nonprofit she worked in AI Governance. During that time she was part of the team that introduced the Algorithmic and Deep Fakes Algorithmic Acts, as well as the No Biometric Barriers to Housing Act to the US House of Representatives. Nkonde started her career as a broadcast journalist and worked at the BBC, CNN & ABC. She also writes widely on race and tech, as well as holding fellowships at Harvard and Stanford. + +### What influenced you to pursue a career in technology? + +My fear of the computer when I went back to college. I was afraid of the computer because I dropped out of college. After and going back, I made it my mission to learn all I can. This is still my motto to this day, learning never stops. —Tameika Reed + +I won’t mince words, I was a child geek! At 10 years old I started writing GW-BASIC from code that I read in printed magazines. Every single day. I gave it a bit of a break to have a life while I went to high school, but when it came time to pick a major for college, it was an easy choice. I stayed in technology thanks to the amazing mentors and colleagues I’ve had along the way. —Michael Scott Winslow + +I’ve been writing software since I was in middle school. I like being able to tell computers to do things and seeing the results. As an adult, I quickly realized that having a job that gave me satisfaction and paid well was the way to go. —Bryan Liles + +I wanted to explore the questions around why so few black women were being hired by tech companies. —Mutale Nkonde + +### Is there a particular person or people in open source and the tech world who have inspired you? + +I get inspired by a lot of other people and projects. For example, I love seeing others come to [Women In Linux][6] and are sure where they want to go. I try to give people a 360-view of tech so they can make a decision on what they like. Its easy to say I want to be in tech but it’s hard to get started and stay. You don’t have to be just a coder/programmer but you can be a cloud architect. —Tameika Reed + +[Kelsey Hightower][7], [Bryan Liles][4], and Kim Scott inspire me very much. They are so REAL! They say things that I feel and experience every day. Get your job done! Stop complaining! Own your actions and understand how you contribute to your situation! [Gene Kim][8] is a big inspiration as well. As a leader in the DevOps movement, I see myself following and emulating a lot of things he does. —Michael Scott Winslow + +No. I didn’t see the inspiration I wanted, so I’ve worked hard to be the inspiration I needed 20 years ago. —Bryan Liles + +There are so many! One of my favorites is [Dorothy Vaughan][9]: She was the first person in the US to program an IBM Watson computer. Her story is captured in the movie Hidden Figures. —Mutale Nkonde + +### Are there particular resources you would recommend for minorities wanting to break into tech? + +Yes, I recommend finding folks on Twitter and just ask questions. Here is a list of people I follow and admire in tech: —Tameika Reed + + * [@techgirl1908][10] + * [@bryanl][4] + * [@kelseyhightower][7] + * [@kstewart][11] + * [@tiffani][12] + * [@EricaJoy][13] + * [@womeninlinux][6] + * [@ArlanWasHere][14] + * [@blkintechnology][15] + * [@digundiv][16] + + + +Respected bootcamps are really cutting down the time it takes to break into the tech industry. I’ve met several professionals who went through bootcamps who have outshined their 4-year institution counterparts. I think we can really start respecting everything that people bring to the table, rather than technical fluency. —Michael Scott Winslow + +I’m not sure I can recommend anything specific. Tech is a big thing and there isn’t an easy answer. My advice is to pick something you think will be interested in and work to become an expert on the topic. Start asking why instead of how, and also start understanding how things work together. — Bryan Liles + +It really depends on the type of work they want to do. For people working at the intersection of tech and social justice, I would recommend the book [Algorithms of Oppression][17] by Safiya Noble. —Mutale Nkonde + +### What advice would you give to a person of color considering technology as their career? + +I suggest you study your craft. You will be a forever learner. There will always be someone or something in your way how you respond and move will be on you. Never take the first offer push back and know your worth. I look at tech like I look at art. It takes time to develop so be patient with yourself. It's okay to unplug and say no. —Tameika Reed + +As someone who is a bit of a protector of the industry, I don’t want people who are not suited for technology. So really decide if you have the personality for tech. Are you a problem solver? Are you more logical than emotional? Do you constantly find yourself creating processes? If so, no matter your background, I think you can find a home in tech. —Michael Scott Winslow + +It is not going to be simple. Your progress will be slowed because of your race. You will have to work harder. Use this adversity as a strength. You will be better prepared than those around you and when the opportunity arises, you will be able to tackle it. Find a network of those who look like you. Air grievances in private and show strength in public. You belong and you can succeed. —Bryan Liles + +To think beyond working for a company, the field of public interest tech is growing, our work centers on how technology impacts real people. Many of the people leading this work are women of color and Black women are making huge strides. Mutale Nkonde + +### What does Black History Month mean to you? + +It means never stop because you can never forget. —Tameika Reed + +Black History Month to me means focusing on the Tuskegee Airmen and not slavery. Highlighting how we contributed to history and not how were victims of it. I want people to understand where our pride comes from and not our anger. There are a lot of really bad things that happened to our people and we are still right here. Strong! —Michael Scott Winslow + +Black History Month is a time to reflect on the forgotten history of black people in the United States. I take it as a time to be thankful for the sacrifices my ancestors made. —Bryan Liles + +It is a time to center the contributions black people have made across the globe. I love it, it is one of my favorite times of year. —Mutale Nkonde + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/careers-tech-minorities + +作者:[Shilla Saebi][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/shillasaebi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/meeting-team-listen-communicate.png?itok=KEBP6vZ_ (Team meeting) +[2]: https://www.linkedin.com/in/tameika-reed-1a7290128/ +[3]: https://twitter.com/michaelswinslow +[4]: https://twitter.com/bryanl +[5]: https://twitter.com/mutalenkonde +[6]: https://twitter.com/WomenInLinux +[7]: https://twitter.com/kelseyhightower +[8]: https://twitter.com/RealGeneKim +[9]: https://en.wikipedia.org/wiki/Dorothy_Vaughan +[10]: https://twitter.com/techgirl1908 +[11]: https://twitter.com/kstewart +[12]: https://twitter.com/tiffani +[13]: https://twitter.com/EricaJoy +[14]: https://twitter.com/ArlanWasHere +[15]: https://twitter.com/blkintechnology +[16]: https://twitter.com/digundiv +[17]: http://algorithmsofoppression.com/ From 06f08a2029e56fe85c2b6164e12a9dc205924238 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 29 Feb 2020 01:08:56 +0800 Subject: [PATCH 138/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200228=20Intel?= =?UTF-8?q?=20takes=20aim=20at=20Huawei=205G=20market=20presence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200228 Intel takes aim at Huawei 5G market presence.md --- ... takes aim at Huawei 5G market presence.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sources/talk/20200228 Intel takes aim at Huawei 5G market presence.md diff --git a/sources/talk/20200228 Intel takes aim at Huawei 5G market presence.md b/sources/talk/20200228 Intel takes aim at Huawei 5G market presence.md new file mode 100644 index 0000000000..22caa3c0f6 --- /dev/null +++ b/sources/talk/20200228 Intel takes aim at Huawei 5G market presence.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Intel takes aim at Huawei 5G market presence) +[#]: via: (https://www.networkworld.com/article/3529354/intel-takes-aim-at-huawei-5g-market-presence.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Intel takes aim at Huawei 5G market presence +====== +Intel has ambitious plans to grab the 5G base station marketplace, which is still in its infancy. +Christopher Hebert/IDG + +Intel on Monday introduced a raft of new processors, and while updates to the Xeon Scalable lineup led the parade, the real news is Intel's efforts to go after the embattled Huawei Technologies in the 5G market. + +Intel unveiled its first ever 5G integrated chip platform, the Atom P5900, for use in base stations. Navin Shenoy, executive vice president and general manager of the data platforms group at Intel, said the product is designed for 5G's high bandwidth and low latency and combines compute, 100Gb performance and acceleration into a single SoC. + +"It delivers a performance punch in packet security throughput, and improved packet balancing throughput versus using software alone," Shenoy said in the video accompanying the announcement. Intel claims the dynamic load balancer native to the Atom P5900 chip is 3.7 times more efficient at packet balancing throughput than software alone. + +Shenoy said Ericsson, Nokia, and ZTE have announced that they will use the Atom P5900 in their base stations. Intel hopes to be the market leader for silicon base station chips by 2021, aiming for 40% of the market and six million 5G base stations by 2024. + +That's pretty aggressive, but the 5G fields are very green and there is plenty of room for growth. Despite all the mobile provider's commercials boasting of 5G availability, the fact is, true 5G phones are only just coming to market now, and the number of base stations is minimal. 5G has a long ramp ahead. + +The Atom P5900 puts Intel in competition with China's Huawei, which U.S. federal authorities have repeatedly labeled a security risk. Huawei has been barred from several nations, including the U.S., England, Japan, and Australia. However, Huawei also said it has secured more than 90 commercial 5G contracts globally. + +Until now, Ericsson and Nokia have asked developers such as Broadcom to help develop base station chips, while Samsung designs and manufactures its own 5G base station chips. + +**[ [Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][1] ]** + +### Second Generation Xeon Scalable processors + +Intel's latest launch also includes 18 2nd Gen Xeon Scalable processors; one is branded Bronze, four are Silver, and 13 are Gold. The upgraded lineup targets the entry-level to medium-range market, leaving the Platinum to duke it out with the high end AMD Epyc processors. + +The new processors range from 8 to 28 cores and include a variety of clock speeds that go down as the core count goes up. They have TDP ratings that range from 85 watts for the eight-core, 1.9Ghz Bronze 3206R to 205 watts for the 28-core, 2.7Ghz Gold 6258R. (Intel and other chip makers measure a processor's power draw with a specification called thermal design power, or TDP.) ** +** + +While most of the chips are meant for standard data center use, some processors – including the Xeon Gold 6200U, Silver 4200R, Sliver 4210T and Bronze 3200R – are specifically meant for single-socket, entry-level servers, as well as edge, networking and IoT uses. + +Intel also introduced the Intel Ethernet 700 Network Adapter, which comes with hardware-enhanced precision timing designed specifically for 5G and other scenarios with very low latency and timing requirements. + +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/3529354/intel-takes-aim-at-huawei-5g-market-presence.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From 0ae335104bb7c430b4afec3b44532b1ee6d0a40b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 29 Feb 2020 01:10:25 +0800 Subject: [PATCH 139/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200228=20Conver?= =?UTF-8?q?ting=20between=20uppercase=20and=20lowercase=20on=20the=20Linux?= =?UTF-8?q?=20command=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200228 Converting between uppercase and lowercase on the Linux command line.md --- ...and lowercase on the Linux command line.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/tech/20200228 Converting between uppercase and lowercase on the Linux command line.md diff --git a/sources/tech/20200228 Converting between uppercase and lowercase on the Linux command line.md b/sources/tech/20200228 Converting between uppercase and lowercase on the Linux command line.md new file mode 100644 index 0000000000..a2819e3ff7 --- /dev/null +++ b/sources/tech/20200228 Converting between uppercase and lowercase on the Linux command line.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Converting between uppercase and lowercase on the Linux command line) +[#]: via: (https://www.networkworld.com/article/3529409/converting-between-uppercase-and-lowercase-on-the-linux-command-line.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Converting between uppercase and lowercase on the Linux command line +====== +Converting text between uppercase and lowercase can be very tedious, especially when you want to avoid inadvertent misspellings. Fortunately, Linux provides a handful of commands that can make the job very easy. +[andy.brandon50][1] [(CC BY-SA 2.0)][2] + +There are many ways to change text on the Linux command line from lowercase to uppercase and vice versa. In fact, you have an impressive set of commands to choose from. This post examines some of the best commands for the job and how you can get them to do just what you want. + +### Using tr + +The **tr** (translate) command is one of the easiest to use on the command line or within a script. If you have a string that you want to be sure is in uppercase, you just pass it through a **tr** command like this: + +``` +$ echo Hello There | tr [:lower:] [:upper:] +HELLO THERE +``` + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +Below is an example of using this kind of command in a script when you want to be sure that all of the text that is added to a file is in uppercase for consistency: + +``` +#!/bin/bash + +echo -n "Enter department name: " +read dept +echo $dept | tr [:lower:] [:upper:] >> depts +``` + +Switching the order to [:upper:] [:lower:] would have the opposite effect, putting all the department names in lowercase: + +``` +echo $dept | tr [:upper:] [:lower:] >> depts +``` + +Similarly, you could use the **sed** command's **A-Z** and **a-z** strings to accomplish the same thing: + +``` +echo $dept | tr a-z A-Z >> depts +``` + +As you undoubtedly suspect, reversing the order of the a-z and A-Z strings will have the opposite effect, turning the text to all lowercase. + +### Using awk + +The **awk** command lets you do the same thing with its **toupper** and **tolower** options. The command in the script shown in the previous example could be done this way instead: + +[][4] + +``` +echo $dept | awk '{print toupper($0)}' >> depts +``` + +The reverse (switching to lowercase) would look like this: + +``` +echo $dept | awk '{print tolower($0)}' >> depts +``` + +### Using sed + +The **sed** (stream editor) command also does a great job of switching between upper- and lowercase. This command would have the same effect as the first of the two shown above. + +``` +echo $dept | sed 's/[a-z]/\U&/g' >> depts +``` + +Switching from uppercase to lowercase would simply involve replacing the **U** near the end of the line with an **L**. + +``` +echo $dept | sed 's/[A-Z]/\L&/g' >> depts +``` + +### Manipulating text in a file + +Both **awk** and **sed** also allow you to change the case of text for entire files. So, you just found out your boss wanted those department names in all lowercase? No problem. Just run a command like this with the file name provided: + +``` +$ awk '{print tolower($0)}' depts +finance +billing +bookkeeping +``` + +If you want to overwrite the **depts** file, instead of just displaying its contents in lowercase, you would need to do something like this: + +``` +$ awk '{print tolower($0)}' depts > depts- +$ mv depts- depts +``` + +Making the change with **sed**, however, you can avoid that last step because **sed** can edit a file "in place" as shown here, leaving the file intact, but the text in all lowercase: + +``` +$ sed 's/[A-Z]/\L&/g' depts +``` + +### Capitalizing first letters only + +To capitalize only the first letters of words in a string, you can do something like this: + +``` +$ echo design \& engineering| sed -e "s/\b\(.\)/\u\1/g" +Design & Engineering +``` + +That command will ensure that first letters are capitalized, but won't change the rest of the letters. + +### Making sure only first letters are uppercase + +It's a little more challenging when you want to change text so that only first letters are in uppercase. Say you're manipulating a list of staff members' names and you want them to be formatted in the normal Firstname Lastname manner. + +##### with sed + +You could use a considerably more complex **sed** command to ensure this result: + +``` +$ echo design \& ENGINEERING | sed 's/\b\([[:alpha:]]\)\([[:alpha:]]*\)\b/\u\1\L\2/g' +Design & Engineering +``` + +##### with python + +If you have python loaded, you can run a command like this that also formats text so that only the first letters of each word are capitalized and the command may be a little easier to parse than the **sed** command shown above: + +``` +$ echo -n "design & engineering" | python3 -c "import sys; print(sys.stdin.read().title())" +Design & Engineering +``` + +There are many ways to change the formatting of text between upper- and lowercase. Which works best depends in part of whether you're manipulating a single string or an entire file and how you want the end result to look. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3529409/converting-between-uppercase-and-lowercase-on-the-linux-command-line.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.flickr.com/photos/54027476@N07/4999959929 +[2]: https://creativecommons.org/licenses/by-sa/2.0/legalcode +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From dd6a1537e8aa381ddf567afe9929f2a0f321a0a8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 29 Feb 2020 11:47:56 +0800 Subject: [PATCH 140/260] PRF @heguangzhi --- ...sing Python and GNU Octave to plot data.md | 388 ++++-------------- 1 file changed, 90 insertions(+), 298 deletions(-) diff --git a/translated/tech/20200220 Using Python and GNU Octave to plot data.md b/translated/tech/20200220 Using Python and GNU Octave to plot data.md index 0c11406995..f0728a32d4 100644 --- a/translated/tech/20200220 Using Python and GNU Octave to plot data.md +++ b/translated/tech/20200220 Using Python and GNU Octave to plot data.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Using Python and GNU Octave to plot data) @@ -10,270 +10,69 @@ 使用 Python 和 GNU Octave 绘制数据 ====== -了解如何使用 Python 和 GNU Octave 完成一项常见的数据科学任务。 -![分析:图表和图形][1] +> 了解如何使用 Python 和 GNU Octave 完成一项常见的数据科学任务。 -数据科学是跨越编程语言的知识领域。有些人以解决这一领域的问题而闻名,而另一些人则鲜为人知。这篇文章将帮助你熟悉用一些流行语言做数据科学。 +![](https://img.linux.net.cn/data/attachment/album/202002/29/114750tr7qykssk90yrvyz.jpg) -### 为数据科学选择 Python 和 GNU Octave +数据科学是跨越编程语言的知识领域。有些语言以解决这一领域的问题而闻名,而另一些则鲜为人知。这篇文章将帮助你熟悉用一些流行的语言完成数据科学的工作。 -我经常尝试学习一种新的编程语言。为什么?这主要是对旧方式的厌倦和对新方式的好奇的结合。当我开始编程时,我唯一知道的语言是 C 语言。那些年的编程生涯既艰难又危险,因为我不得不手动分配内存,管理指针,并记得释放内存。 +### 选择 Python 和 GNU Octave 做数据科学工作 -然后一个朋友建议我试试 Python,现在编程生活变得简单多了。虽然程序运行变得慢多了,但我不必通过编写分析软件来受苦了。然而,我很快就意识到每种语言都有比其他语言更适合自己应用场景。后来我学习了其他一些语言,每种语言都给我带来了一些新的启发。发现新的编程风格让我可以将一些解决方案移植到其他语言中,这样一切都变得有趣多了。 +我经常尝试学习一种新的编程语言。为什么?这既有对旧方式的厌倦,也有对新方式的好奇。当我开始学习编程时,我唯一知道的语言是 C 语言。那些年的编程生涯既艰难又危险,因为我必须手动分配内存、管理指针、并记得释放内存。 -为了对一种新的编程语言(及其文档)有所了解,我总是从编写一些执行我熟悉的任务的示例程序开始。为此,我将解释如何用 Python 和 GNU Octave 编写一个程序来完成一个你可以归类为数据科学的特殊任务。如果你已经熟悉其中一种语言,从中开始,浏览其他语言,寻找相似之处和不同之处。这并不是对编程语言的详尽比较,只是一个小小的展示。 +后来一个朋友建议我试试 Python,现在我的编程生活变得轻松多了。虽然程序运行变得慢多了,但我不必通过编写分析软件来受苦了。然而,我很快就意识到每种语言都有比其它语言更适合自己的应用场景。后来我学习了一些其它语言,每种语言都给我带来了一些新的启发。发现新的编程风格让我可以将一些解决方案移植到其他语言中,这样一切都变得有趣多了。 -所有的程序都应该在[命令行][2]上运行,而不是用[图形用户界面][3](GUI)。完整的例子可以在[多语种知识库][4]中找到。 +为了对一种新的编程语言(及其文档)有所了解,我总是从编写一些执行我熟悉的任务的示例程序开始。为此,我将解释如何用 Python 和 GNU Octave 编写一个程序来完成一个你可以归类为数据科学的特殊任务。如果你已经熟悉其中一种语言,从它开始,然后通过其他语言寻找相似之处和不同之处。这篇文章并不是对编程语言的详尽比较,只是一个小小的展示。 + +所有的程序都应该在[命令行][2]上运行,而不是用[图形用户界面][3](GUI)。完整的例子可以在 [polyglot_fit 存储库][4]中找到。 ### 编程任务 你将在本系列中编写的程序: - * 从[CSV文件][5]中读取数据 - * 用直线插入数据(例如 _f(x)=m ⋅ x + q_) + * 从 [CSV 文件][5]中读取数据 + * 用直线插入数据(例如 `f(x)=m ⋅ x + q`) * 将结果生成图像文件 -这是许多数据科学家遇到的常见情况。示例数据是第一组[Anscombe's quartet][6],如下表所示。这是一组人工构建的数据,当用直线拟合时会给出相同的结果,但是它们的曲线非常不同。数据文件是一个文本文件,以制表符作为列分隔,以几行作为标题。此任务将仅使用第一组(例如:前两列)。 - -I - -II - -III - -IV - -x - -y - -x - -y - -x - -y - -x - -y - -10.0 - -8.04 - -10.0 - -9.14 - -10.0 - -7.46 - -8.0 - -6.58 - -8.0 - -6.95 - -8.0 - -8.14 - -8.0 - -6.77 - -8.0 - -5.76 - -13.0 - -7.58 - -13.0 - -8.74 - -13.0 - -12.74 - -8.0 - -7.71 - -9.0 - -8.81 - -9.0 - -8.77 - -9.0 - -7.11 - -8.0 - -8.84 - -11.0 - -8.33 - -11.0 - -9.26 - -11.0 - -7.81 - -8.0 - -8.47 - -14.0 - -9.96 - -14.0 - -8.10 - -14.0 - -8.84 - -8.0 - -7.04 - -6.0 - -7.24 - -6.0 - -6.13 - -6.0 - -6.08 - -8.0 - -5.25 - -4.0 - -4.26 - -4.0 - -3.10 - -4.0 - -5.39 - -19.0 - -12.50 - -12.0 - -10.84 - -12.0 - -9.13 - -12.0 - -8.15 - -8.0 - -5.56 - -7.0 - -4.82 - -7.0 - -7.26 - -7.0 - -6.42 - -8.0 - -7.91 - -5.0 - -5.68 - -5.0 - -4.74 - -5.0 - -5.73 - -8.0 - -6.89 +这是许多数据科学家遇到的常见情况。示例数据是 [Anscombe 的四重奏][6]的第一组,如下表所示。这是一组人工构建的数据,当用直线拟合时会给出相同的结果,但是它们的曲线非常不同。数据文件是一个文本文件,以制表符作为列分隔符,开头几行作为标题。此任务将仅使用第一组(即前两列)。 ### Python 方式 - -[Python][7]是一种通用编程语言,是当今最流行的语言之一(从[TIOBE index][8]、[RedMonk编程语言排名][9]、[编程语言流行指数][10]、[State of the Octoverse of GitHub][11]和其他来源的调查结果可以看出)。这是一种[解释的语言][12];因此,源代码由执行指令的程序读取和评估。它有一个全面的[标准库][13]并且总体上非常好用(我没有参考这最后一句话;这只是我的拙见)。 +[Python][7] 是一种通用编程语言,是当今最流行的语言之一(依据 [TIOBE 指数][8]、[RedMonk 编程语言排名][9]、[编程语言流行指数][10]、[GitHub Octoverse 状态][11]和其他来源的调查结果)。它是一种[解释型语言][12];因此,源代码由执行该指令的程序读取和评估。它有一个全面的[标准库][13]并且总体上非常好用(我对这最后一句话没有证据;这只是我的拙见)。 #### 安装 -要使用 Python 开发,你需要解释器和一些库。最低要求是: +要使用 Python 开发,你需要解释器和一些库。最低要求是: - * [NumPy][14]用于合适的数组和矩阵操作 - * [SciPy][15]进行数据科学 - * [Matplotlib][16]绘图 +* [NumPy][14] 用于简化数组和矩阵的操作 +* [SciPy][15] 用于数据科学 +* [Matplotlib][16] 用于绘图 在 [Fedora][17] 安装它们是很容易的: - ``` -`sudo dnf install python3 python3-numpy python3-scipy python3-matplotlib` +sudo dnf install python3 python3-numpy python3-scipy python3-matplotlib ``` -#### 注释代码 +#### 代码注释 - -在 Python中,[注释][18]是通过在行首添加一个 **#** 来实现的,该行的其余部分将被解释器丢弃: +在 Python中,[注释][18]是通过在行首添加一个 `#` 来实现的,该行的其余部分将被解释器丢弃: ``` -`# This is a comment ignored by the interpreter.` +# 这是被解释器忽略的注释。 ``` -[fitting_python.py][19]示例使用注释在源代码中插入许可信息,第一行是[特殊注释][20],它允许在命令行上执行脚本: +[fitting_python.py][19] 示例使用注释在源代码中插入许可证信息,第一行是[特殊注释][20],它允许该脚本在命令行上执行: ``` -`#! /usr/bin/env python3` +#!/usr/bin/env python3 ``` -这一行通知命令行解释器,脚本需要由程序**python3**执行。 -#### Required libraries +这一行通知命令行解释器,该脚本需要由程序 `python3` 执行。 -在 Python 中,库和模块可以作为一个对象导入(如示例中的第一行),其中包含库的所有函数和成员。通过使用 **as** 规范可以用于定义标签并重命名它们: +#### 需要的库 + +在 Python 中,库和模块可以作为一个对象导入(如示例中的第一行),其中包含库的所有函数和成员。可以通过使用 `as` 方式用自定义标签重命名它们: ``` import numpy as np @@ -281,11 +80,11 @@ from scipy import stats import matplotlib.pyplot as plt ``` -你也可以决定只导入一个子模块(如第二行和第三行)。语法有两个(或多或少)等效选项: **import module.submodule** 和 **from module import submodule**。 +你也可以决定只导入一个子模块(如第二行和第三行)。语法有两个(基本上)等效的方式:`import module.submodule` 和 `from module import submodule`。 #### 定义变量 -Python 的变量是在第一次赋值时被声明的: +Python 的变量是在第一次赋值时被声明的: ``` input_file_name = "anscombe.csv" @@ -295,48 +94,46 @@ column_x = 0 column_y = 1 ``` -变量类型由分配给变量的值推断。没有常量值的变量,除非它们在模块中声明并且只能被读取。习惯上,不被修改的变量应该用大写字母命名。 +变量类型由分配给变量的值推断。没有具有常量值的变量,除非它们在模块中声明并且只能被读取。习惯上,不应被修改的变量应该用大写字母命名。 #### 打印输出 -通过命令行运行程序意味着输出只能打印在终端上。Python 有[**print()**][21]函数,默认情况下,该函数打印其参数,并在输出的末尾添加一个换行符: +通过命令行运行程序意味着输出只能打印在终端上。Python 有 [print()][21] 函数,默认情况下,该函数打印其参数,并在输出的末尾添加一个换行符: ``` -`print("#### Anscombe's first set with Python ####")` +print("#### Anscombe's first set with Python ####") ``` -在 Python 中,可以将**print()**函数与[字符串类][23]的[格式化能力][22]相结合。字符串具有**format**方法,可用于向字符串本身添加一些格式化文本。例如,可以添加格式化的浮点数,例如: - +在 Python 中,可以将 `print()` 函数与[字符串类][23]的[格式化能力][22]相结合。字符串具有`format` 方法,可用于向字符串本身添加一些格式化文本。例如,可以添加格式化的浮点数,例如: ``` -`print("Slope: {:f}".format(slope))` +print("Slope: {:f}".format(slope)) ``` #### 读取数据 -使用 NumPy 和 函数[**genfromtxt()**][24]读取CSV文件非常容易,该函数生成[NumPy数组][25]: - +使用 NumPy 和函数 [genfromtxt()][24] 读取 CSV 文件非常容易,该函数生成 [NumPy 数组][25]: ``` -`data = np.genfromtxt(input_file_name, delimiter = delimiter, skip_header = skip_header)` +data = np.genfromtxt(input_file_name, delimiter = delimiter, skip_header = skip_header) ``` -在 Python中,一个函数可以有可变数量的参数,您可以通过指定所需的参数来让它传递一个子集。数组是非常强大的矩阵状对象,可以很容易地分割成更小的数组: +在 Python 中,一个函数可以有数量可变的参数,你可以通过指定所需的参数来传递一个参数的子集。数组是非常强大的矩阵状对象,可以很容易地分割成更小的数组: ``` x = data[:, column_x] y = data[:, column_y] ``` -冒号选择整个范围,也可以用来选择子范围。例如,要选择数组的前两行,可以使用: +冒号选择整个范围,也可以用来选择子范围。例如,要选择数组的前两行,可以使用: ``` -`first_two_rows = data[0:1, :]` +first_two_rows = data[0:1, :] ``` #### 拟合数据 -SciPy提供了方便的数据拟合功能,例如[**linregress()**][26]功能。该函数提供了一些与拟合相关的重要值,如斜率、截距和两个数据集的相关系数: +SciPy 提供了方便的数据拟合功能,例如 [linregress()][26] 功能。该函数提供了一些与拟合相关的重要值,如斜率、截距和两个数据集的相关系数: ``` slope, intercept, r_value, p_value, std_err = stats.linregress(x, y) @@ -346,25 +143,25 @@ print("Intercept: {:f}".format(intercept)) print("Correlation coefficient: {:f}".format(r_value)) ``` -因为**linregress()**提供了几条信息,所以结果可以同时保存到几个变量中。 +因为 `linregress()` 提供了几条信息,所以结果可以同时保存到几个变量中。 #### 绘图 -Matplotlib 库仅仅绘制数据点,因此,你应该定义要绘制的点的坐标。已经定义了**x** 和 **y** 数组,所以你可以直接绘制它们,但是你还需要代表直线的数据点。 +Matplotlib 库仅仅绘制数据点,因此,你应该定义要绘制的点的坐标。已经定义了 `x` 和 `y` 数组,所以你可以直接绘制它们,但是你还需要代表直线的数据点。 ``` -`fit_x = np.linspace(x.min() - 1, x.max() + 1, 100)` +fit_x = np.linspace(x.min() - 1, x.max() + 1, 100) ``` -[**linspace()**][27]函数可以方便地在两个值之间生成一组等距值。利用强大的 NumPy 数组可以轻松计算纵坐标,该数组可以像普通数值变量一样在公式中使用: +[linspace()][27] 函数可以方便地在两个值之间生成一组等距值。利用强大的 NumPy 数组可以轻松计算纵坐标,该数组可以像普通数值变量一样在公式中使用: ``` -`fit_y = slope * fit_x + intercept` +fit_y = slope * fit_x + intercept ``` -公式在数组中逐元素应用;因此,结果在初始数组中具有相同数量的条目。 +该公式在数组中逐元素应用;因此,结果在初始数组中具有相同数量的条目。 -要绘图,首先,定义一个包含所有图形的[图形对象][28]: +要绘图,首先,定义一个包含所有图形的[图形对象][28]: ``` fig_width = 7 #inch @@ -374,7 +171,7 @@ fig_dpi = 100 fig = plt.figure(figsize = (fig_width, fig_height), dpi = fig_dpi) ``` -一个图形可以画几个图;在 Matplotlib 中,这些图块被称为[轴][29]。本示例定义一个单轴对象来绘制数据点: +一个图形可以画几个图;在 Matplotlib 中,这些图被称为[轴][29]。本示例定义一个单轴对象来绘制数据点: ``` ax = fig.add_subplot(111) @@ -389,26 +186,25 @@ ax.set_xlabel('x') ax.set_ylabel('y') ``` -将该图保存到[PNG image file][30]中,有: +将该图保存到 [PNG 图形文件][30]中,有: ``` -`fig.savefig('fit_python.png')` +fig.savefig('fit_python.png') ``` -如果要显示(而不是保存)绘图,请调用: - +如果要显示(而不是保存)该绘图,请调用: ``` -`plt.show()` +plt.show() ``` -此示例引用了绘图部分中使用的所有对象:它定义了对象 **fig** 和对象 **ax**。这种技术细节是不必要的,因为 **plt** 对象可以直接用于绘制数据集。《[Matplotlib 教程][31]展示了这样一个界面: +此示例引用了绘图部分中使用的所有对象:它定义了对象 `fig` 和对象 `ax`。这在技术上是不必要的,因为 `plt` 对象可以直接用于绘制数据集。《[Matplotlib 教程][31]》展示了这样一个接口: ``` -`plt.plot(fit_x, fit_y)` +plt.plot(fit_x, fit_y) ``` -坦率地说,我不喜欢这种方法,因为它隐藏了各种对象之间发生的重要的的交互。不幸的是,有时[官方的例子][32]有点令人困惑,因为他们倾向于使用不同的方法。在这个简单的例子中,引用图形对象是不必要的,但是在更复杂的例子中(例如在图形用户界面中嵌入图形时),引用图形对象就变得很重要了。 +坦率地说,我不喜欢这种方法,因为它隐藏了各种对象之间发生的重要交互。不幸的是,有时[官方的例子][32]有点令人困惑,因为他们倾向于使用不同的方法。在这个简单的例子中,引用图形对象是不必要的,但是在更复杂的例子中(例如在图形用户界面中嵌入图形时),引用图形对象就变得很重要了。 #### 结果 @@ -427,27 +223,27 @@ Correlation coefficient: 0.816421 ### GNU Octave 方式 -[GNU Octave][34]语言主要用于数值计算。它提供了一个简单的操作向量和矩阵的语法,并且有一些强大的绘图工具。这是一种像 Python 一样的解释语言。由于 Octave的语法是[最兼容][35] [MATLAB][36],它经常被描述为一个免费的替代 MATLAB 的方案。Octave 没有被列为最流行的编程语言,但是 MATLAB 是,所以 Octave 在某种意义上是相当流行的。MATLAB 早于 NumPy,我觉得它是受到了前者的启发。当你看这个例子时,你会看到相似之处。 +[GNU Octave][34] 语言主要用于数值计算。它提供了一个简单的操作向量和矩阵的语法,并且有一些强大的绘图工具。这是一种像 Python 一样的解释语言。由于 Octave 的语法[几乎兼容][35] [MATLAB][36],它经常被描述为一个替代 MATLAB 的免费方案。Octave 没有被列为最流行的编程语言,而 MATLAB 则是,所以 Octave 在某种意义上是相当流行的。MATLAB 早于 NumPy,我觉得它是受到了前者的启发。当你看这个例子时,你会看到相似之处。 #### 安装 -[fitting_octave.m][37]的例子只需要基本的 Octave 包,在 Fedora 中安装相当简单: +[fitting_octave.m][37] 的例子只需要基本的 Octave 包,在 Fedora 中安装相当简单: ``` -`sudo dnf install octave` +sudo dnf install octave ``` -#### 注释代码 +#### 代码注释 -在Octave中,你可以用百分比符号(**%**)为代码添加注释,如果不需要与 MATLAB 兼容,你也可以使用 **#**。使用 **#** 的选项允许你从 Python 示例中编写相同的特殊注释行,以便直接在命令行上执行脚本。 +在 Octave 中,你可以用百分比符号(``%`)为代码添加注释,如果不需要与 MATLAB 兼容,你也可以使用 `#`。使用 `#` 的选项允许你编写像 Python 示例一样的特殊注释行,以便直接在命令行上执行脚本。 #### 必要的库 -本例中使用的所有内容都包含在基本包中,因此你不需要加载任何新的库。如果你需要一个库,[语法][38]是 **pkg load module**。该命令将模块的功能添加到可用功能列表中。在这方面,Python 具有更大的灵活性。 +本例中使用的所有内容都包含在基本包中,因此你不需要加载任何新的库。如果你需要一个库,[语法][38]是 `pkg load module`。该命令将模块的功能添加到可用功能列表中。在这方面,Python 具有更大的灵活性。 #### 定义变量 -变量的定义与 Python 的语法基本相同: +变量的定义与 Python 的语法基本相同: ``` input_file_name = "anscombe.csv"; @@ -457,46 +253,45 @@ column_x = 1; column_y = 2; ``` -请注意,行尾有一个分号;这不是必需的,但是它会抑制行结果的输出。如果没有分号,解释器将打印表达式的结果: +请注意,行尾有一个分号;这不是必需的,但是它会抑制该行结果的输出。如果没有分号,解释器将打印表达式的结果: ``` -octave:1> input_file_name = "anscombe.csv" +octave:1> input_file_name = "anscombe.csv" input_file_name = anscombe.csv -octave:2> sqrt(2) -ans =  1.4142 +octave:2> sqrt(2) +ans = 1.4142 ``` #### 打印输出结果 -强大的功能[**printf()**][39]是用来在终端上打印的。与 Python 不同,**printf()** 函数不会自动在打印字符串的末尾添加换行,因此你必须添加它。第一个参数是一个字符串,可以包含要传递给函数的其他参数的格式信息,例如: +强大的函数 [printf()][39] 是用来在终端上打印的。与 Python 不同,`printf()` 函数不会自动在打印字符串的末尾添加换行,因此你必须添加它。第一个参数是一个字符串,可以包含要传递给函数的其他参数的格式信息,例如: ``` -`printf("Slope: %f\n", slope);` +printf("Slope: %f\n", slope); ``` -在 Python 中,格式是内置在字符串本身中的,但是在 Octave 中,它是特定于 **printf()** 函数。 +在 Python 中,格式是内置在字符串本身中的,但是在 Octave 中,它是特定于 `printf()` 函数。 #### 读取数据 -[**dlmread()**][40]函数可以读取类似CSV文件的文本内容: +[dlmread()][40] 函数可以读取类似 CSV 文件的文本内容: ``` -`data = dlmread(input_file_name, delimiter, skip_header, 0);` +data = dlmread(input_file_name, delimiter, skip_header, 0); ``` -结果是一个[矩阵][41]对象,这是 Octave 中的基本数据类型之一。矩阵可以用类似于 Python 的语法进行切片: +结果是一个[矩阵][41]对象,这是 Octave 中的基本数据类型之一。矩阵可以用类似于 Python 的语法进行切片: ``` x = data(:, column_x); y = data(:, column_y); ``` -根本的区别是索引从1开始,而不是从0开始。因此,在该示例中,__x__列是第一列。 +根本的区别是索引从 1 开始,而不是从 0 开始。因此,在该示例中,`x` 列是第一列。 #### 拟合数据 -要用直线拟合数据,可以使用[**polyfit()**][42]函数。它用一个多项式拟合输入数据,所以你只需要使用一阶多项式: - +要用直线拟合数据,可以使用 [polyfit()][42] 函数。它用一个多项式拟合输入数据,所以你只需要使用一阶多项式: ``` p = polyfit(x, y, 1); @@ -505,14 +300,13 @@ slope = p(1); intercept = p(2); ``` -结果是具有多项式系数的矩阵;因此,它选择前两个索引。要确定相关系数,请使用[**corr()**][43]函数: - +结果是具有多项式系数的矩阵;因此,它选择前两个索引。要确定相关系数,请使用 [corr()][43] 函数: ``` -`r_value = corr(x, y);` +r_value = corr(x, y); ``` -最后,使用 **printf()** 函数打印结果: +最后,使用 `printf()` 函数打印结果: ``` printf("Slope: %f\n", slope); @@ -529,9 +323,9 @@ fit_x = linspace(min(x) - 1, max(x) + 1, 100); fit_y = slope * fit_x + intercept; ``` -与 NumPy 的相似性也很明显,因为它使用了[**linspace()**][44]函数,其行为就像 Python 的等效版本一样。 +与 NumPy 的相似性也很明显,因为它使用了 [linspace()][44] 函数,其行为就像 Python 的等效版本一样。 -同样,与 Matplotlib 一样,首先创建一个[图][45]对象,然后创建一个[轴][46]对象来保存这些图: +同样,与 Matplotlib 一样,首先创建一个[图][45]对象,然后创建一个[轴][46]对象来保存这些图: ``` fig_width = 7; %inch @@ -547,8 +341,7 @@ set(ax, "fontsize", 14); set(ax, "linewidth", 2); ``` - -要设置轴对象的属性,请使用[**set()**][47]函数。然而,该接口相当混乱,因为该函数需要一个逗号分隔的属性和值对列表。这些对只是代表属性名的一个字符串和代表该属性值的第二个对象的连续。还有其他设置各种属性的功能: +要设置轴对象的属性,请使用 [set()][47] 函数。然而,该接口相当混乱,因为该函数需要一个逗号分隔的属性和值对列表。这些对只是代表属性名的一个字符串和代表该属性值的第二个对象的连续。还有其他设置各种属性的函数: ``` xlim(ax, [min(x) - 1, max(x) + 1]); @@ -557,8 +350,7 @@ xlabel(ax, 'x'); ylabel(ax, 'y'); ``` -标图是用[**plot()**][48]功能实现的。默认行为是每次调用都会重置坐标轴,因此需要使用函数[**hold()**][49]。 - +绘图是用 [plot()][48] 功能实现的。默认行为是每次调用都会重置坐标轴,因此需要使用函数 [hold()][49]。 ``` hold(ax, "on"); @@ -575,14 +367,14 @@ plot(ax, x, y, hold(ax, "off"); ``` -此外,还可以在 **plot()** 函数中添加属性和值对。[legend][50]必须单独创建,标签应手动声明: +此外,还可以在 `plot()` 函数中添加属性和值对。[legend][50] 必须单独创建,标签应手动声明: ``` lg = legend(ax, "Fit", "Data"); set(lg, "location", "northwest"); ``` -最后,将输出保存到PNG图像: +最后,将输出保存到 PNG 图像: ``` image_size = sprintf("-S%f,%f", fig_width * fig_dpi, fig_height * fig_dpi); @@ -594,13 +386,13 @@ print(fig, 'fit_octave.png',       image_resolution); ``` -令人困惑的是,在这种情况下,选项被作为一个字符串传递,带有属性名和值。因为在 Octave 字符串中没有 Python 的格式化工具,所以必须使用[**sprintf()**][51]函数。它的行为就像**printf()**函数,但是它的结果不是打印出来的,而是作为字符串返回的。 +令人困惑的是,在这种情况下,选项被作为一个字符串传递,带有属性名和值。因为在 Octave 字符串中没有 Python 的格式化工具,所以必须使用 [sprintf()][51] 函数。它的行为就像 `printf()` 函数,但是它的结果不是打印出来的,而是作为字符串返回的。 -在这个例子中,就像在 Python 中一样,图形对象很明显被引用以保持它们之间的交互。如果说 Python 在这方面的文档有点混乱,那么[Octave 的文档][52]就更糟糕了。我发现的大多数例子都不关心引用对象;相反,它们依赖于绘图命令作用于当前活动图形。全局[根图形对象][53]跟踪现有的图形和轴。 +在这个例子中,就像在 Python 中一样,图形对象很明显被引用以保持它们之间的交互。如果说 Python 在这方面的文档有点混乱,那么 [Octave 的文档][52]就更糟糕了。我发现的大多数例子都不关心引用对象;相反,它们依赖于绘图命令作用于当前活动图形。全局[根图形对象][53]跟踪现有的图形和轴。 #### 结果 -命令行上的结果输出是: +命令行上的结果输出是: ``` #### Anscombe's first set with Octave #### @@ -613,9 +405,9 @@ Correlation coefficient: 0.816421 ![Plot and fit of the dataset obtained with Octave][54] -### 下一个 +###接下来 -Python 和 GNU Octave 都可以绘制出相同的信息,尽管它们的实现方式不同。如果你想探索其他语言来完成类似的任务,我强烈建议你看看[Rosetta 代码][55]。这是一个了不起的资源,可以看到如何用多种语言解决同样的问题。 +Python 和 GNU Octave 都可以绘制出相同的信息,尽管它们的实现方式不同。如果你想探索其他语言来完成类似的任务,我强烈建议你看看 [Rosetta Code][55]。这是一个了不起的资源,可以看到如何用多种语言解决同样的问题。 你喜欢用什么语言绘制数据?在评论中分享你的想法。 @@ -626,7 +418,7 @@ via: https://opensource.com/article/20/2/python-gnu-octave-data-science 作者:[Cristiano L. Fontana][a] 选题:[lujun9972][b] 译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 51190970f87ace21c1516d08ad4baa24ae394979 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 29 Feb 2020 11:48:25 +0800 Subject: [PATCH 141/260] PUB @heguangzhi https://linux.cn/article-11943-1.html --- .../20200220 Using Python and GNU Octave to plot data.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200220 Using Python and GNU Octave to plot data.md (99%) diff --git a/translated/tech/20200220 Using Python and GNU Octave to plot data.md b/published/20200220 Using Python and GNU Octave to plot data.md similarity index 99% rename from translated/tech/20200220 Using Python and GNU Octave to plot data.md rename to published/20200220 Using Python and GNU Octave to plot data.md index f0728a32d4..f2f773d67e 100644 --- a/translated/tech/20200220 Using Python and GNU Octave to plot data.md +++ b/published/20200220 Using Python and GNU Octave to plot data.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11943-1.html) [#]: subject: (Using Python and GNU Octave to plot data) [#]: via: (https://opensource.com/article/20/2/python-gnu-octave-data-science) [#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) From 86e28a40ab3652b66b0d68e84bd31e7220c105d1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 29 Feb 2020 12:19:28 +0800 Subject: [PATCH 142/260] Rename sources/tech/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md to sources/talk/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md --- .../20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md (100%) diff --git a/sources/tech/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md b/sources/talk/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md similarity index 100% rename from sources/tech/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md rename to sources/talk/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md From eb022d4afda3b7be570ce9ef6721ca3fff0db9d0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 29 Feb 2020 12:29:09 +0800 Subject: [PATCH 143/260] PRF --- .../20200220 Using Python and GNU Octave to plot data.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/published/20200220 Using Python and GNU Octave to plot data.md b/published/20200220 Using Python and GNU Octave to plot data.md index f2f773d67e..5f2b7dba66 100644 --- a/published/20200220 Using Python and GNU Octave to plot data.md +++ b/published/20200220 Using Python and GNU Octave to plot data.md @@ -36,6 +36,8 @@ 这是许多数据科学家遇到的常见情况。示例数据是 [Anscombe 的四重奏][6]的第一组,如下表所示。这是一组人工构建的数据,当用直线拟合时会给出相同的结果,但是它们的曲线非常不同。数据文件是一个文本文件,以制表符作为列分隔符,开头几行作为标题。此任务将仅使用第一组(即前两列)。 +![](https://img.linux.net.cn/data/attachment/album/202002/29/122805h3yrs1dkrgysssxk.png) + ### Python 方式 [Python][7] 是一种通用编程语言,是当今最流行的语言之一(依据 [TIOBE 指数][8]、[RedMonk 编程语言排名][9]、[编程语言流行指数][10]、[GitHub Octoverse 状态][11]和其他来源的调查结果)。它是一种[解释型语言][12];因此,源代码由执行该指令的程序读取和评估。它有一个全面的[标准库][13]并且总体上非常好用(我对这最后一句话没有证据;这只是我的拙见)。 @@ -235,7 +237,7 @@ sudo dnf install octave #### 代码注释 -在 Octave 中,你可以用百分比符号(``%`)为代码添加注释,如果不需要与 MATLAB 兼容,你也可以使用 `#`。使用 `#` 的选项允许你编写像 Python 示例一样的特殊注释行,以便直接在命令行上执行脚本。 +在 Octave 中,你可以用百分比符号(`%`)为代码添加注释,如果不需要与 MATLAB 兼容,你也可以使用 `#`。使用 `#` 的选项允许你编写像 Python 示例一样的特殊注释行,以便直接在命令行上执行脚本。 #### 必要的库 From 36acc8122a1f524e3a7d69d373686804504b8525 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 29 Feb 2020 12:31:33 +0800 Subject: [PATCH 144/260] Rename sources/tech/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md to sources/talk/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md --- ...rs the Game Dev Business With a New Open Source Game Engine.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md (100%) diff --git a/sources/tech/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md b/sources/talk/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md similarity index 100% rename from sources/tech/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md rename to sources/talk/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md From e35b0a7bb23ccfc3130b7067cef0771185db2d2b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 29 Feb 2020 12:50:29 +0800 Subject: [PATCH 145/260] PRF @geekpi --- ... to use byobu to multiplex SSH sessions.md | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/translated/tech/20200212 How to use byobu to multiplex SSH sessions.md b/translated/tech/20200212 How to use byobu to multiplex SSH sessions.md index 9c871b4840..220223b8ac 100644 --- a/translated/tech/20200212 How to use byobu to multiplex SSH sessions.md +++ b/translated/tech/20200212 How to use byobu to multiplex SSH sessions.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to use byobu to multiplex SSH sessions) @@ -9,52 +9,55 @@ 如何使用 byobu 复用 SSH 会话 ====== -Byobu 能让你在保持会话活跃的情况下维护多个终端窗口、通过 SSH 连接、断开、重连以及共享访问。 + +> Byobu 能让你在保持会话活跃的情况下维护多个终端窗口,通过 SSH 连接、断开、重连以及共享访问。 + ![Person drinking a hat drink at the computer][1] -[Byobu][2] 是基于文本的窗口管理器和终端多路复用器。它类似于 [GNU Screen][3],但更现代,更直观。它还适用于大多数 Linux、BSD 和 Mac 发行版。 +[Byobu][2] 是基于文本的窗口管理器和终端多路复用器。它类似于 [GNU Screen][3],但更现代、更直观。它还适用于大多数 Linux、BSD 和 Mac 发行版。 -Byobu 能让你在保持会话活跃的情况下维护多个终端窗口、通过 SSH (secure shell)连接、断开、重连,甚至让其他人访问。 +Byobu 能让你在保持会话活跃的情况下维护多个终端窗口、通过 SSH(secure shell)连接、断开、重连,甚至让其他人访问。 -比如,你 SSH 进入树莓派或服务器,并运行(比如) **sudo apt update && sudo apt upgrade**,然后你在它运行的时候失去了互联网连接,你的命令会丢失无效。然而,如果你首先启动 byobu 会话,那么它会继续运行,在你重连后,你会发现它仍在继续运行。 +比如,你 SSH 进入树莓派或服务器,并运行(比如) `sudo apt update && sudo apt upgrade`,然后你在它运行的时候失去了互联网连接,你的命令会丢失无效。然而,如果你首先启动 byobu 会话,那么它会继续运行,在你重连后,你会发现它仍在继续运行。 ![The byobu logo is a fun play on screens.][4] -Byobu 的日语术语是指装饰性多面板屏风,可作为折叠式隔断,我认为这很合适。 +Byobu 名称来自于日语的装饰性多面板屏风,它可作为折叠式隔断,我认为这很合适。 要在 Debian/Raspbian/Ubuntu 上安装 byobu: -**sudo apt install byobu** +``` +sudo apt install byobu +``` -接着启用它 +接着启用它: -**byobu-enable** +``` +byobu-enable +``` -现在,请退出 SSH 会话并重新登录,你将会在 byobu 会话中登录。运行类似 **sudo apt update** 命令并关闭窗口(或输入转义序列([**Enter**+**~**+**.**][5])并重新登录。你将看到更新在你离开后还在运行。 +现在,请退出 SSH 会话并重新登录,你将会在 byobu 会话中登录。运行类似 `sudo apt update` 命令并关闭窗口(或输入转义序列([Enter + ~ + .][5])并重新登录。你将看到更新命令在你离开后还在运行。 -有_很多_我不常使用的功能。我通常使用的是: - - * **F2** – 新窗口 - * **F3/F4** – 在窗口间导航 - * **Ctrl**+**F2** – 垂直拆分窗格 - * **Shift**+**F2** – 水平拆分窗格 - * **Shift**+**左箭头/Shift**+**右箭头** – 在拆分窗格间导航 - * **Shift**+**F11** – 放大(或缩小)拆分窗格 +有*很多*我不常使用的功能。我通常使用的是: + * `F2` – 新窗口 + * `F3/F4` – 在窗口间导航 + * `Ctrl`+`F2` – 垂直拆分窗格 + * `Shift`+`F2` – 水平拆分窗格 + * `Shift`+`左箭头/Shift`+`右箭头` – 在拆分窗格间导航 + * `Shift`+`F11` – 放大(或缩小)拆分窗格 ### 我们如何使用 byobu -Byobu 对于 [piwheels][6](一个用于树莓派的方便的,预编译 Python 包)的维护很方便。我门水平拆分了窗格,在上半部分显示了 piwheels 监视器,在下半部分实时显示了 syslog 条目。接着,如果我们想要做其他事情,我们可以切换到另外一个窗口。当我们进行协作调查时,这特别方便,因为当我在 IRC 中聊天时,我可以看到我的同事 Dave 输入了什么(并纠正他的错字)。 +Byobu 对于维护 [piwheels][6](一个用于树莓派的方便的,预编译 Python 包)很好用。我水平拆分了窗格,在上半部分显示了 piwheels 监视器,在下半部分实时显示了 syslog 条目。接着,如果我们想要做其他事情,我们可以切换到另外一个窗口。当我们进行协作分析时,这特别方便,因为当我在 IRC 中聊天时,我可以看到我的同事 Dave 输入了什么(并纠正他的错字)。 我在家庭和办公服务器上启用了 byobu,因此,当我登录到任何一台计算机时,一切都与我离开时一样。它正在运行多个作业、在特定目录中保留一个窗口,以另一个用户身份运行进程等。 ![byobu screenshot][7] -Byobu 也很方便用于在树莓派上进行开发。你可以在桌面上启动它,运行命令,然后 SSH 进入,并连接到该命令运行所在的会话。请注意,启用 byobu 不会更改终端启动器的功能。只需运行 **byobu** 即可启动它。 +Byobu 对于在树莓派上进行开发也很方便。你可以在桌面上启动它,运行命令,然后 SSH 进入,并连接到该命令运行所在的会话。请注意,启用 byobu 不会更改终端启动器的功能。只需运行 `byobu` 即可启动它。 -* * * - -_本文最初发表在 Ben Nuttall 的 [Tooling blog][8] 中,并获许重用_ +本文最初发表在 Ben Nuttall 的 [Tooling blog][8] 中,并获许重用。 -------------------------------------------------------------------------------- @@ -63,7 +66,7 @@ via: https://opensource.com/article/20/2/byobu-ssh 作者:[Ben Nuttall][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 16b0bee0a9e0fc0ec81bb17196196c14596b4f44 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 29 Feb 2020 12:51:39 +0800 Subject: [PATCH 146/260] PUB @geekpi https://linux.cn/article-11944-1.html --- .../20200212 How to use byobu to multiplex SSH sessions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200212 How to use byobu to multiplex SSH sessions.md (98%) diff --git a/translated/tech/20200212 How to use byobu to multiplex SSH sessions.md b/published/20200212 How to use byobu to multiplex SSH sessions.md similarity index 98% rename from translated/tech/20200212 How to use byobu to multiplex SSH sessions.md rename to published/20200212 How to use byobu to multiplex SSH sessions.md index 220223b8ac..061ca4c41a 100644 --- a/translated/tech/20200212 How to use byobu to multiplex SSH sessions.md +++ b/published/20200212 How to use byobu to multiplex SSH sessions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11944-1.html) [#]: subject: (How to use byobu to multiplex SSH sessions) [#]: via: (https://opensource.com/article/20/2/byobu-ssh) [#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) From 627e8617369fe7b7eafc72c2bb964f9603451574 Mon Sep 17 00:00:00 2001 From: hj24 Date: Sat, 29 Feb 2020 23:21:19 +0800 Subject: [PATCH 147/260] translating by hj24 --- .../20190702 One CI-CD pipeline per product to rule them all.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190702 One CI-CD pipeline per product to rule them all.md b/sources/tech/20190702 One CI-CD pipeline per product to rule them all.md index 2a7fcb31de..0fd04ee54a 100644 --- a/sources/tech/20190702 One CI-CD pipeline per product to rule them all.md +++ b/sources/tech/20190702 One CI-CD pipeline per product to rule them all.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hj24) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b727c5df8020aa2589fefa0c525ccae3ea7d5412 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 1 Mar 2020 01:01:31 +0800 Subject: [PATCH 148/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200301=20Rememb?= =?UTF-8?q?er=20Unity8=20from=20Ubuntu=3F=20UBports=20is=20Renaming=20it?= =?UTF-8?q?=20to=20Lomiri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md --- ...buntu- UBports is Renaming it to Lomiri.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/tech/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md diff --git a/sources/tech/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md b/sources/tech/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md new file mode 100644 index 0000000000..7badbfc8a2 --- /dev/null +++ b/sources/tech/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Remember Unity8 from Ubuntu? UBports is Renaming it to Lomiri) +[#]: via: (https://itsfoss.com/unity8-lomiri/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Remember Unity8 from Ubuntu? UBports is Renaming it to Lomiri +====== + +Ever since Ubuntu abandoned the Unity project, UBports continued the maintenance and development of Unity. On February 27th 2020, [UBports][1] announced that they are giving Unity8 a new branding in the form of Lomiri. + +### Unity8 is now Lomiri + +![Unity8 in action | Image Credit: UBports][2] + +[UBports announced][3] that the Unity8 desktop environment would be renamed as Lomiri. They gave three reasons for this fairly drastic announcement. + +First, they want to avoid confusion with the [Unity game engine][4]. Quite a few people confused the two. UBports noted that they are frequently receiving questions regarding “how to import 3D models and meshes into our shell”. When you search “Unity” in your favorite search engine, most of the top links are for the game engine. + +The second reason for the name change has to do with the new effort to package Unity8 for Debian. Unfortunately, many of the Unity8’s dependencies have Ubuntu in the name, for example, _**ubuntu-ui-toolkit**_. Debian packagers warned that packages that have Ubuntu in the name may not be accepted into [Debian][5]. + +Finally, UBports said the name change would improve verbal communications. Saying Unity8 repeatedly can be a mouthful. People would not have to worry about confusing “users of Ubuntu Unity and Unity (the game engine)”. + +UBports went on to stress that the name change was not “triggered by any action from Canonical or the Ubuntu community, legal or otherwise”. + +They noted that this name change was the perfect time for them to switch to [GitHub alternative GitLab][6] for their development. + +Interestingly, the announcement did not explain how they picked Lomiri as the new name. All they said is that “We went through many different names before settling on Lomiri. All of them had problems with pronunciation, availability, or other related issues.” + +UBports noted that most Ubuntu Touch users would be unaffected by the name change. Developers and power users might notice some changes, but UBports “will strive to maintain backwards compatibility within Ubuntu Touch for the foreseeable future”. + +### What Exactly is Being Renamed? + +![][7] + +According to the announcement, packages that have either Ubuntu or Unity in the title will be affected. For example, + + * **unity8**, containing the shell, will become **lomiri** + * **ubuntu-ui-toolkit** will become **lomiri-ui-toolkit** + * **ubuntu-download-manager** will become **lomiri-download-manager** + + + +On top of this, interfaces call will change, as well. “For example, the **Ubuntu.Components** QML import will change to **Lomiri.Components**.” For the sake of backwards compatibility, Ubuntu Touch images will not change too much. “Developers will only need to update to the new API when they’d like to package their apps for other distributions.” + +### What Will Stay the Same? + +Since renaming packages can cause quite a few cascading problems, UBports wants to limit the number of packages they change. They don’t expect the following things to change. + + * Packages that don’t use the “Ubuntu” or “Unity” names + * Ubuntu Touch will remain the same + * Any components which are already used by other projects and accepted into other distributions + + + +### Final Thoughts + +![][8] + +Overall, I think this change will be good for Ubuntu Touch in the long run. I understand why [Canonical][9] picked the Unity name for their convergence desktop, but I think the desktop environment was overshadowed by the game engine from the beginning. This will give them room to breathe and also free up valuable coding time. The less time spent replying to questions about 3D models the more time that can be spent creating a convergent desktop. + +If you have any further questions or concerns about the name change, you visit the [UBports forms][10]. They have set up a thread specifically for this topic. + +Don’t hesitate to share our views on it in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/unity8-lomiri/ + +作者:[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://ubports.com/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/unity8_ubports.png?ssl=1 +[3]: https://ubports.com/blog/ubports-blog-1/post/lomiri-new-name-same-great-unity8-265 +[4]: https://en.wikipedia.org/wiki/Unity_(game_engine) +[5]: https://www.debian.org/ +[6]: https://itsfoss.com/github-alternatives/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/Unity8-lomiri.png?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/ubports.jpeg?ssl=1 +[9]: https://canonical.com/ +[10]: https://forums.ubports.com/topic/3874/unity8-is-now-lomiri From 80a007676b6f09812f1ed41cb99d8fe3231ab5d5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 1 Mar 2020 09:26:05 +0800 Subject: [PATCH 149/260] Rename sources/tech/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md to sources/news/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md --- ...member Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md (100%) diff --git a/sources/tech/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md b/sources/news/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md similarity index 100% rename from sources/tech/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md rename to sources/news/20200301 Remember Unity8 from Ubuntu- UBports is Renaming it to Lomiri.md From 58c05ae5709820e9091d40d901b605ea057e0f8e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Mar 2020 11:29:25 +0800 Subject: [PATCH 150/260] PRF @chenmu-kk --- .../20190113 Editing Subtitles in Linux.md | 146 +++++++++++++----- 1 file changed, 107 insertions(+), 39 deletions(-) diff --git a/translated/tech/20190113 Editing Subtitles in Linux.md b/translated/tech/20190113 Editing Subtitles in Linux.md index 84f299fbf4..24d66c4ad7 100644 --- a/translated/tech/20190113 Editing Subtitles in Linux.md +++ b/translated/tech/20190113 Editing Subtitles in Linux.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) -[#]: translator: (chenmu-kk ) -[#]: reviewer: ( ) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Editing Subtitles in Linux) [#]: via: (https://itsfoss.com/editing-subtitles) [#]: author: (Shirish https://itsfoss.com/author/shirish/) -在 Linux 中编辑字幕 +如何在 Linux 中编辑字幕 ====== 我作为一位世界电影和地区电影爱好者已经几十年了。这期间字幕是一个必不可少的工具,它可以使我享受来自不同国家不同语言的优秀电影。 @@ -20,15 +20,15 @@ ### 从闭路字幕数据中提取字幕 -大概在 2012,2013 年我开始了解到有一款叫做 [CCEextractor][2] 的工具。随着时间的推移,它已经成为我必不可少的工具之一 ,尤其是当我偶然发现一份内含有字幕的媒体文件。 +大概在 2012、2013 年我开始了解到有一款叫做 [CCEextractor][2] 的工具。随着时间的推移,它已经成为我必不可少的工具之一,尤其是当我偶然发现一份内含有字幕的媒体文件。 - CCExtractor 负责解析视频文件以及从闭路字幕数据中产生独立的字幕文件。 +CCExtractor 负责解析视频文件以及从闭路字幕closed captions数据中产生独立的字幕文件。 - CCExtractor 是一个跨平台、免费且开源的工具。自它形成的那年起该工具已经成熟了不少而如今已成为 [GSOC][3] 和谷歌编码输入的一部分。 +CCExtractor 是一个跨平台的、自由开源工具。自它形成的那年起该工具已经成熟了不少而如今已成为 [GSOC][3] 和谷歌编码输入的一部分。 -简单来说,这个工具是一系列或多或少的脚本,这些脚本以一种连续的顺序一个接着一个地给你提供提取到的字幕。 +简单来说,这个工具基本上是一系列脚本,这些脚本以一种顺序方式一个接着一个地给你提供提取到的字幕。 -你可以按照 [本页][5] 的 CCExtractor 安装指南进行操作。 +你可以按照[本页][5]的 CCExtractor 安装指南进行操作。 若安装后你想从媒体文件中提取字幕,请按以下步骤操作: @@ -38,13 +38,70 @@ ccextractor 该命令将会输出以下内容: -它会大致浏览媒体文件。在这个例子中,它发现媒体文件是马拉雅拉姆文并且格式是 .mkv[6] 。之后它将字幕文件提取出来,命名为源文件名并添加“_eng”后缀。 - - CCExtractor 是一款用来增强字幕功能和字幕编辑的优秀工具,我将在下一部分对它进行介绍。 - ``` -趣味阅读:在 [vicaps][7] 有一份有趣的字幕简介,会讲解和分享为何字幕对我们如此重要。对于那些对这类话题感兴趣的人来说,这里面也有许多电影制作的细节。 +$ ccextractor $something.mkv +CCExtractor 0.87, Carlos Fernandez Sanz, Volker Quetschke. +Teletext portions taken from Petr Kutalek's telxcc +-------------------------------------------------------------------------- +Input: $something.mkv +[Extract: 1] [Stream mode: Autodetect] +[Program : Auto ] [Hauppage mode: No] [Use MythTV code: Auto] +[Timing mode: Auto] [Debug: No] [Buffer input: No] +[Use pic_order_cnt_lsb for H.264: No] [Print CC decoder traces: No] +[Target format: .srt] [Encoding: UTF-8] [Delay: 0] [Trim lines: No] +[Add font color data: Yes] [Add font typesetting: Yes] +[Convert case: No] [Video-edit join: No] +[Extraction start time: not set (from start)] +[Extraction end time: not set (to end)] +[Live stream: No] [Clock frequency: 90000] +[Teletext page: Autodetect] +[Start credits text: None] +[Quantisation-mode: CCExtractor's internal function] +----------------------------------------------------------------- +Opening file: $something.mkv +File seems to be a Matroska/WebM container +Analyzing data in Matroska mode + +Document type: matroska +Timecode scale: 1000000 +Muxing app: libebml v1.3.1 + libmatroska v1.4.2 +Writing app: mkvmerge v8.2.0 ('World of Adventure') 64bit +Title: $something + +Track entry: + Track number: 1 + UID: 1 + Type: video + Codec ID: V_MPEG4/ISO/AVC + Language: mal + Name: $something + +Track entry: + Track number: 2 + UID: 2 + Type: audio + Codec ID: A_MPEG/L3 + Language: mal + Name: $something + +Track entry: + Track number: 3 + UID: somenumber + Type: subtitle + Codec ID: S_TEXT/UTF8 + Name: $something + 99% | 144:34 +100% | 144:34 +Output file: $something_eng.srt +Done, processing time = 6 seconds +Issues? Open a ticket here +https://github.com/CCExtractor/ccextractor/issues ``` +它会大致浏览媒体文件。在这个例子中,它发现该媒体文件是马拉雅拉姆语言(mal)并且格式是 [.mkv][6]。之后它将字幕文件提取出来,命名为源文件名并添加“_eng”后缀。 + +CCExtractor 是一款用来增强字幕功能和字幕编辑的优秀工具,我将在下一部分对它进行介绍。 + +> 趣味阅读:在 [vicaps][7] 有一份有趣的字幕提要,它讲解和分享为何字幕对我们如此重要。对于那些对这类话题感兴趣的人来说,这里面也有许多电影制作的细节。 ### 用 SubtitleEditor 工具编辑字幕 @@ -52,9 +109,22 @@ ccextractor 当进入一个简单的文本编辑器时,一个 srt 文件看起来会是这个样子: -我分享的节选字幕来自于一部非常老的德国电影 [卡里加里博士的小屋 (1920)][9] 。 +``` +1 +00:00:00,959 --> 00:00:13,744 +"THE CABINET +OF DR. CALIGARI" - Subtitleeditor 是一款非常棒的字幕编辑软件。字幕编辑器可以用来设置字幕持续时间、与多媒体文件同步的字幕帧率以及字幕间隔时间等等。接下来我将在这分享一些基本的字幕编辑。 +2 +00:00:40,084 --> 00:01:02,088 +A TALE of the modern re-appearance of an 11th Century Myth +involting the strange and mysterious influence +of a mountebank monk over a somnambulist. +``` + +我分享的节选字幕来自于一部非常老的德国电影《[卡里加里博士的小屋][9]》(1920)。 + +Subtitleeditor 是一款非常棒的字幕编辑软件。字幕编辑器可以用来设置字幕持续时间、与多媒体文件同步的字幕帧率以及字幕间隔时间等等。接下来我将在这分享一些基本的字幕编辑。 ![][10] @@ -70,35 +140,33 @@ sudo apt install subtitleeditor 如果你发现字幕与视频不同步,一个原因可能是视频文件的帧率与字幕文件的帧率并不一致。 -你如何得知这些文件的帧率呢,然后呢? +你如何得知这些文件的帧率呢,然后呢?为了获取视频文件的帧率,你可以使用 `mediainfo` 工具。首先你可能需要发行版的包管理器来安装它。 -为了获取视频文件的帧率,你可以使用 mediainfo 工具。首先你可能需要发行版的包管理器来安装它。 - -使用 mediainfo 非常得简单: +使用 `mediainfo` 非常简单: ``` $ mediainfo somefile.mkv | grep Frame - Format settings : CABAC / 4 Ref Frames - Format settings, ReFrames : 4 frames - Frame rate mode : Constant - Frame rate : 25.000 FPS - Bits/(Pixel*Frame) : 0.082 - Frame rate : 46.875 FPS (1024 SPF) + Format settings : CABAC / 4 Ref Frames + Format settings, ReFrames : 4 frames + Frame rate mode : Constant + Frame rate : 25.000 FPS + Bits/(Pixel*Frame) : 0.082 + Frame rate : 46.875 FPS (1024 SPF) ``` -现在你可以看到视频文件的帧率是 25.000 FPS 。我们看到的另一个帧率则是音频文件的帧率。虽然我会分享为何在视频解码和音频解码等地方会使用特定的 fps ,但这将会是一个不同的主题,与它相关的历史有很多。 +现在你可以看到视频文件的帧率是 25.000 FPS 。我们看到的另一个帧率则是音频文件的帧率。虽然我可以分享为何在视频解码和音频解码等地方会使用特定的 fps,但这将会是一个不同的主题,与它相关的历史信息有很多。 下一个问题是解决字幕文件的帧率,这个稍微有点复杂。 -通常情况下,大多数字幕都是压缩格式的。将.zip归档文件和字幕文件(以 XXX.srt 结尾)一起解压缩。除此之外,通常还会有一个同名的 .info 文件,该文件可能包含字幕的帧率。 +通常情况下,大多数字幕都是压缩格式的。将.zip 归档文件和字幕文件(以 XXX.srt 结尾)一起解压缩。除此之外,通常还会有一个同名的 .info 文件,该文件可能包含字幕的帧率。 -如果不是,那么通常最好去某个站点并从具有该帧速率信息的站点下载字幕。对于这个特定的德文文件,我将使用 [Opensubtitle.org][11] 。 +如果不是,那么通常最好去某个站点并从具有该帧速率信息的站点下载字幕。对于这个特定的德文文件,我使用 [Opensubtitle.org][11] 来找到它。 -正如你在链接中所看到的,字幕的帧率是 23.976 FPS 。将我的视频文件以 25.000 FPS 的帧率进行播放,显而易见结果并不好。 +正如你在链接中所看到的,字幕的帧率是 23.976 FPS 。很明显,它不能与帧率为 25.000 FPS 的视频文件一起很好地播放。 -在这种情况下,你可以使用字幕编辑工具来改变字幕文件的帧率: +在这种情况下,你可以使用字幕编辑工具来改变字幕文件的帧率。 -按下 CTRL+A 选择字幕文件中的全部内容。点击 Timings -> Change Framerate ,将 23.976 fps 改为 25.000 fps 或者你想要的其他帧率,保存已更改的文件。 +按下 `CTRL+A` 选择字幕文件中的全部内容。点击 “Timings -> Change Framerate” ,将 23.976 fps 改为 25.000 fps 或者你想要的其他帧率,保存已更改的文件。 ![synchronize frame rates of subtitles in Linux][12] @@ -110,7 +178,7 @@ $ mediainfo somefile.mkv | grep Frame 在这种情况下,请按以下步骤进行操作: -按下 CTRL+A 键选中字幕文件的全部内容。点击 Timings -> 选择 Move Subtitle 。 +按下 `CTRL+A` 键选中字幕文件的全部内容。点击 “Timings -> Select Move Subtitle” 。 ![Move subtitles using Subtitle Editor on Linux][13] @@ -118,17 +186,17 @@ $ mediainfo somefile.mkv | grep Frame ![Move subtitles using Subtitle Editor in Linux][14] -如果你想要时间更精确一点,那么可以使用 [mpv][15] 来查看电影或者媒体文件并点击 timing ,如果你点击了进度条(可以显示电影或者媒体文件的播放进度),它也会显示微秒。 +如果你想要时间更精确一点,那么可以使用 [mpv][15] 来查看电影或者媒体文件并点击进度条(可以显示电影或者媒体文件的播放进度),它也会显示微秒。 -通常我喜欢精准无误的操作,因此我会试着尽可能地仔细调节。相较于人类的反应时间来说,MPV中的反应时间很精确。如果我想要极其精确的时间,那么我可以使用像 [Audacity][16] 之类的东西,但是那是另一种工具,你可以在上面做更多的事情。那也将会是我未来博客中将要探讨的东西。 +通常我喜欢精准无误的操作,因此我会试着尽可能地仔细调节。相较于人类的反应时间来说,MPV 中的反应时间很精确。如果我想要极其精确的时间,那么我可以使用像 [Audacity][16] 之类的东西,但是那是另一种工具,你可以在上面做更多的事情。那也将会是我未来博客中将要探讨的东西。 #### 调整字幕间隔时间 -有时,两种方法都采用了还不够,甚至你可能需要缩短或曾加间隔时间以使其与媒体文件同步。这是较为繁琐的工作之一,因为你必须单独确定每个句子的间隔时间。尤其是在媒体文件中帧率可变的情况下(现已很少见,但你仍然会得到此类文件) +有时,两种方法都采用了还不够,甚至你可能需要缩短或增加间隔时间以使其与媒体文件同步。这是较为繁琐的工作之一,因为你必须单独确定每个句子的间隔时间。尤其是在媒体文件中帧率可变的情况下(现已很少见,但你仍然会得到此类文件) -在这种设想下,你可能因为无法实现自动编辑而不得不手动的修改间隔时间。最好的方式是修改视频文件(会降低视频质量)或者换另一个更高质量的片源,用你喜欢的设置对它进行 [转码][17] 。这又是一重大任务,以后我会在我的一些博客文章上阐明。 +在这种设想下,你可能因为无法实现自动编辑而不得不手动的修改间隔时间。最好的方式是修改视频文件(会降低视频质量)或者换另一个更高质量的片源,用你喜欢的设置对它进行[转码][17] 。这又是一重大任务,以后我会在我的一些博客文章上阐明。 -### 结论 +### 总结 以上我分享的内容或多或少是对现有字幕文件的改进。如果从头开始,你需要花费大量的时间。我完全没有分享这一点,因为一部电影或一个小时内的任何视频材料都可以轻易地花费 4-6 个小时,甚至更多的时间,这取决于字幕员的技巧、耐心、上下文、行话、口音、是否是以英语为母语的人、翻译等,所有的这些都会对字幕的质量产生影响。 @@ -140,8 +208,8 @@ via: https://itsfoss.com/editing-subtitles 作者:[Shirish][a] 选题:[lujun9972][b] -译者:[chenmu-kk](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7fc1cf392abba3e988c8dfadc25f7e4f9e4e7b0a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Mar 2020 11:35:25 +0800 Subject: [PATCH 151/260] PUB @chenmu-kk https://linux.cn/article-11946-1.html --- .../tech => published}/20190113 Editing Subtitles in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190113 Editing Subtitles in Linux.md (99%) diff --git a/translated/tech/20190113 Editing Subtitles in Linux.md b/published/20190113 Editing Subtitles in Linux.md similarity index 99% rename from translated/tech/20190113 Editing Subtitles in Linux.md rename to published/20190113 Editing Subtitles in Linux.md index 24d66c4ad7..fe3a66da99 100644 --- a/translated/tech/20190113 Editing Subtitles in Linux.md +++ b/published/20190113 Editing Subtitles in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (chenmu-kk) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11946-1.html) [#]: subject: (Editing Subtitles in Linux) [#]: via: (https://itsfoss.com/editing-subtitles) [#]: author: (Shirish https://itsfoss.com/author/shirish/) From 8b0f8fff024f98d228f21bc33485e2d222c4ed7f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Mar 2020 11:36:50 +0800 Subject: [PATCH 152/260] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20202002?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ur components of a distributed tracing system work together.md | 0 .../20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md | 0 .../20190114 Some Advice for How to Make Emacs Tetris Harder.md | 0 ...ing files on Linux- the many variations and how to use them.md | 0 ...190322 12 open source tools for natural language processing.md | 0 .../{ => 202002}/20190407 Manage multimedia files with Git.md | 0 .../20190729 How to structure a multi-file C program- Part 1.md | 0 .../20191022 How to Go About Linux Boot Time Optimisation.md | 0 ...id -words- Handle Chromium - Firefox sessions with org-mode.md | 0 .../20191225 8 Commands to Check Memory Usage on Linux.md | 0 .../20191227 Top CI-CD resources to set you up for success.md | 0 .../20200102 Data streaming and functional programming in Java.md | 0 .../{ => 202002}/20200103 Add scorekeeping to your Python game.md | 0 published/{ => 202002}/20200109 My favorite Bash hacks.md | 0 .../{ => 202002}/20200109 What-s HTTPS for secure computing.md | 0 .../20200112 What I learned going from prison to Python.md | 0 ...00117 Use this Python script to find bugs in your Overcloud.md | 0 ... Keep a journal of your activities with this Python program.md | 0 ...w to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md | 0 .../20200119 One open source chat tool to rule them all.md | 0 ...se this Twitter client for Linux to tweet from the terminal.md | 0 .../{ => 202002}/20200121 Read Reddit from the Linux terminal.md | 0 ... feeds and podcasts in one place with this open source tool.md | 0 ... Screenshot your Linux system configuration with Bash tools.md | 0 .../{ => 202002}/20200123 How to stop typosquatting attacks.md | 0 ...se this open source tool to get your local weather forecast.md | 0 .../20200124 3 handy command-line internet speed tests.md | 0 ...e consoles at once with this open source window environment.md | 0 .../20200125 Use tmux to create the console of your dreams.md | 0 .../20200126 Use Vim to send email and check your calendar.md | 0 .../20200126 What-s your favorite Linux distribution.md | 0 ... Vim to manage your task list and access Reddit and Twitter.md | 0 .../20200128 Send email and check your calendar with Emacs.md | 0 ...0200129 4 cool new projects to try in COPR for January 2020.md | 0 .../20200129 Joplin- The True Open Source Evernote Alternative.md | 0 .../20200129 Showing memory usage in Linux by process and user.md | 0 .../20200130 Meet FuryBSD- A New Desktop BSD Distribution.md | 0 .../{ => 202002}/20200131 Intro to the Linux command line.md | 0 .../20200202 4 Key Changes to Look Out for in Linux Kernel 5.6.md | 0 .../20200203 Give an old MacBook new life with Linux.md | 0 ... Troubleshoot Kubernetes with the power of tmux and kubectl.md | 0 ...ed End of Life- Existing Users Must Upgrade to Ubuntu 19.10.md | 0 published/{ => 202002}/20200205 Getting started with GnuCash.md | 0 .../{ => 202002}/20200206 3 ways to use PostgreSQL commands.md | 0 ...ource eCommerce Platforms to Build Online Shopping Websites.md | 0 ...0200207 Connect Fedora to your Android phone with GSConnect.md | 0 ...7 Customize your internet with an open source search engine.md | 0 ... Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md | 0 ...0207 What is WireGuard- Why Linux Users Going Crazy Over it.md | 0 ...a Codecs in Ubuntu With This Single Command -Beginner-s Tip.md | 0 ... Playing Music on your Fedora Terminal with MPD and ncmpcpp.md | 0 .../20200210 Scan Kubernetes for errors with KRAWL.md | 0 .../20200210 Top hacks for the YaCy open source search engine.md | 0 .../20200211 Dino is a Modern Looking Open Source XMPP Client.md | 0 .../20200212 How to Change the Default Terminal in Ubuntu.md | 0 .../20200212 How to use byobu to multiplex SSH sessions.md | 0 ...re You Can Buy Open Source Apps for Your Linux Distribution.md | 0 .../{ => 202002}/20200213 Why developers like to code at night.md | 0 ...20200214 Digging up IP addresses with the Linux dig command.md | 0 .../{ => 202002}/20200217 How to get MongoDB Server on Fedora.md | 0 published/{ => 202002}/20200217 How to install Vim plugins.md | 0 published/{ => 202002}/20200219 Don-t like IDEs- Try grepgitvi.md | 0 ...19 How Kubernetes Became the Standard for Compute Resources.md | 0 .../20200219 How to Install Latest Git Version on Ubuntu.md | 0 .../20200220 Using Python and GNU Octave to plot data.md | 0 65 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 202002}/20180503 How the four components of a distributed tracing system work together.md (100%) rename published/{ => 202002}/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md (100%) rename published/{ => 202002}/20190114 Some Advice for How to Make Emacs Tetris Harder.md (100%) rename published/{ => 202002}/20190116 Zipping files on Linux- the many variations and how to use them.md (100%) rename published/{ => 202002}/20190322 12 open source tools for natural language processing.md (100%) rename published/{ => 202002}/20190407 Manage multimedia files with Git.md (100%) rename published/{ => 202002}/20190729 How to structure a multi-file C program- Part 1.md (100%) rename published/{ => 202002}/20191022 How to Go About Linux Boot Time Optimisation.md (100%) rename published/{ => 202002}/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md (100%) rename published/{ => 202002}/20191225 8 Commands to Check Memory Usage on Linux.md (100%) rename published/{ => 202002}/20191227 Top CI-CD resources to set you up for success.md (100%) rename published/{ => 202002}/20200102 Data streaming and functional programming in Java.md (100%) rename published/{ => 202002}/20200103 Add scorekeeping to your Python game.md (100%) rename published/{ => 202002}/20200109 My favorite Bash hacks.md (100%) rename published/{ => 202002}/20200109 What-s HTTPS for secure computing.md (100%) rename published/{ => 202002}/20200112 What I learned going from prison to Python.md (100%) rename published/{ => 202002}/20200117 Use this Python script to find bugs in your Overcloud.md (100%) rename published/{ => 202002}/20200118 Keep a journal of your activities with this Python program.md (100%) rename published/{ => 202002}/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md (100%) rename published/{ => 202002}/20200119 One open source chat tool to rule them all.md (100%) rename published/{ => 202002}/20200120 Use this Twitter client for Linux to tweet from the terminal.md (100%) rename published/{ => 202002}/20200121 Read Reddit from the Linux terminal.md (100%) rename published/{ => 202002}/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md (100%) rename published/{ => 202002}/20200122 Screenshot your Linux system configuration with Bash tools.md (100%) rename published/{ => 202002}/20200123 How to stop typosquatting attacks.md (100%) rename published/{ => 202002}/20200123 Use this open source tool to get your local weather forecast.md (100%) rename published/{ => 202002}/20200124 3 handy command-line internet speed tests.md (100%) rename published/{ => 202002}/20200124 Run multiple consoles at once with this open source window environment.md (100%) rename published/{ => 202002}/20200125 Use tmux to create the console of your dreams.md (100%) rename published/{ => 202002}/20200126 Use Vim to send email and check your calendar.md (100%) rename published/{ => 202002}/20200126 What-s your favorite Linux distribution.md (100%) rename published/{ => 202002}/20200127 Use Vim to manage your task list and access Reddit and Twitter.md (100%) rename published/{ => 202002}/20200128 Send email and check your calendar with Emacs.md (100%) rename published/{ => 202002}/20200129 4 cool new projects to try in COPR for January 2020.md (100%) rename published/{ => 202002}/20200129 Joplin- The True Open Source Evernote Alternative.md (100%) rename published/{ => 202002}/20200129 Showing memory usage in Linux by process and user.md (100%) rename published/{ => 202002}/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md (100%) rename published/{ => 202002}/20200131 Intro to the Linux command line.md (100%) rename published/{ => 202002}/20200202 4 Key Changes to Look Out for in Linux Kernel 5.6.md (100%) rename published/{ => 202002}/20200203 Give an old MacBook new life with Linux.md (100%) rename published/{ => 202002}/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md (100%) rename published/{ => 202002}/20200204 Ubuntu 19.04 Has Reached End of Life- Existing Users Must Upgrade to Ubuntu 19.10.md (100%) rename published/{ => 202002}/20200205 Getting started with GnuCash.md (100%) rename published/{ => 202002}/20200206 3 ways to use PostgreSQL commands.md (100%) rename published/{ => 202002}/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md (100%) rename published/{ => 202002}/20200207 Connect Fedora to your Android phone with GSConnect.md (100%) rename published/{ => 202002}/20200207 Customize your internet with an open source search engine.md (100%) rename published/{ => 202002}/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md (100%) rename published/{ => 202002}/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md (100%) rename published/{ => 202002}/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md (100%) rename published/{ => 202002}/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md (100%) rename published/{ => 202002}/20200210 Scan Kubernetes for errors with KRAWL.md (100%) rename published/{ => 202002}/20200210 Top hacks for the YaCy open source search engine.md (100%) rename published/{ => 202002}/20200211 Dino is a Modern Looking Open Source XMPP Client.md (100%) rename published/{ => 202002}/20200212 How to Change the Default Terminal in Ubuntu.md (100%) rename published/{ => 202002}/20200212 How to use byobu to multiplex SSH sessions.md (100%) rename published/{ => 202002}/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md (100%) rename published/{ => 202002}/20200213 Why developers like to code at night.md (100%) rename published/{ => 202002}/20200214 Digging up IP addresses with the Linux dig command.md (100%) rename published/{ => 202002}/20200217 How to get MongoDB Server on Fedora.md (100%) rename published/{ => 202002}/20200217 How to install Vim plugins.md (100%) rename published/{ => 202002}/20200219 Don-t like IDEs- Try grepgitvi.md (100%) rename published/{ => 202002}/20200219 How Kubernetes Became the Standard for Compute Resources.md (100%) rename published/{ => 202002}/20200219 How to Install Latest Git Version on Ubuntu.md (100%) rename published/{ => 202002}/20200220 Using Python and GNU Octave to plot data.md (100%) diff --git a/published/20180503 How the four components of a distributed tracing system work together.md b/published/202002/20180503 How the four components of a distributed tracing system work together.md similarity index 100% rename from published/20180503 How the four components of a distributed tracing system work together.md rename to published/202002/20180503 How the four components of a distributed tracing system work together.md diff --git a/published/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md b/published/202002/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md similarity index 100% rename from published/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md rename to published/202002/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md diff --git a/published/20190114 Some Advice for How to Make Emacs Tetris Harder.md b/published/202002/20190114 Some Advice for How to Make Emacs Tetris Harder.md similarity index 100% rename from published/20190114 Some Advice for How to Make Emacs Tetris Harder.md rename to published/202002/20190114 Some Advice for How to Make Emacs Tetris Harder.md diff --git a/published/20190116 Zipping files on Linux- the many variations and how to use them.md b/published/202002/20190116 Zipping files on Linux- the many variations and how to use them.md similarity index 100% rename from published/20190116 Zipping files on Linux- the many variations and how to use them.md rename to published/202002/20190116 Zipping files on Linux- the many variations and how to use them.md diff --git a/published/20190322 12 open source tools for natural language processing.md b/published/202002/20190322 12 open source tools for natural language processing.md similarity index 100% rename from published/20190322 12 open source tools for natural language processing.md rename to published/202002/20190322 12 open source tools for natural language processing.md diff --git a/published/20190407 Manage multimedia files with Git.md b/published/202002/20190407 Manage multimedia files with Git.md similarity index 100% rename from published/20190407 Manage multimedia files with Git.md rename to published/202002/20190407 Manage multimedia files with Git.md diff --git a/published/20190729 How to structure a multi-file C program- Part 1.md b/published/202002/20190729 How to structure a multi-file C program- Part 1.md similarity index 100% rename from published/20190729 How to structure a multi-file C program- Part 1.md rename to published/202002/20190729 How to structure a multi-file C program- Part 1.md diff --git a/published/20191022 How to Go About Linux Boot Time Optimisation.md b/published/202002/20191022 How to Go About Linux Boot Time Optimisation.md similarity index 100% rename from published/20191022 How to Go About Linux Boot Time Optimisation.md rename to published/202002/20191022 How to Go About Linux Boot Time Optimisation.md diff --git a/published/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md b/published/202002/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md similarity index 100% rename from published/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md rename to published/202002/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md diff --git a/published/20191225 8 Commands to Check Memory Usage on Linux.md b/published/202002/20191225 8 Commands to Check Memory Usage on Linux.md similarity index 100% rename from published/20191225 8 Commands to Check Memory Usage on Linux.md rename to published/202002/20191225 8 Commands to Check Memory Usage on Linux.md diff --git a/published/20191227 Top CI-CD resources to set you up for success.md b/published/202002/20191227 Top CI-CD resources to set you up for success.md similarity index 100% rename from published/20191227 Top CI-CD resources to set you up for success.md rename to published/202002/20191227 Top CI-CD resources to set you up for success.md diff --git a/published/20200102 Data streaming and functional programming in Java.md b/published/202002/20200102 Data streaming and functional programming in Java.md similarity index 100% rename from published/20200102 Data streaming and functional programming in Java.md rename to published/202002/20200102 Data streaming and functional programming in Java.md diff --git a/published/20200103 Add scorekeeping to your Python game.md b/published/202002/20200103 Add scorekeeping to your Python game.md similarity index 100% rename from published/20200103 Add scorekeeping to your Python game.md rename to published/202002/20200103 Add scorekeeping to your Python game.md diff --git a/published/20200109 My favorite Bash hacks.md b/published/202002/20200109 My favorite Bash hacks.md similarity index 100% rename from published/20200109 My favorite Bash hacks.md rename to published/202002/20200109 My favorite Bash hacks.md diff --git a/published/20200109 What-s HTTPS for secure computing.md b/published/202002/20200109 What-s HTTPS for secure computing.md similarity index 100% rename from published/20200109 What-s HTTPS for secure computing.md rename to published/202002/20200109 What-s HTTPS for secure computing.md diff --git a/published/20200112 What I learned going from prison to Python.md b/published/202002/20200112 What I learned going from prison to Python.md similarity index 100% rename from published/20200112 What I learned going from prison to Python.md rename to published/202002/20200112 What I learned going from prison to Python.md diff --git a/published/20200117 Use this Python script to find bugs in your Overcloud.md b/published/202002/20200117 Use this Python script to find bugs in your Overcloud.md similarity index 100% rename from published/20200117 Use this Python script to find bugs in your Overcloud.md rename to published/202002/20200117 Use this Python script to find bugs in your Overcloud.md diff --git a/published/20200118 Keep a journal of your activities with this Python program.md b/published/202002/20200118 Keep a journal of your activities with this Python program.md similarity index 100% rename from published/20200118 Keep a journal of your activities with this Python program.md rename to published/202002/20200118 Keep a journal of your activities with this Python program.md diff --git a/published/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md b/published/202002/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md similarity index 100% rename from published/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md rename to published/202002/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md diff --git a/published/20200119 One open source chat tool to rule them all.md b/published/202002/20200119 One open source chat tool to rule them all.md similarity index 100% rename from published/20200119 One open source chat tool to rule them all.md rename to published/202002/20200119 One open source chat tool to rule them all.md diff --git a/published/20200120 Use this Twitter client for Linux to tweet from the terminal.md b/published/202002/20200120 Use this Twitter client for Linux to tweet from the terminal.md similarity index 100% rename from published/20200120 Use this Twitter client for Linux to tweet from the terminal.md rename to published/202002/20200120 Use this Twitter client for Linux to tweet from the terminal.md diff --git a/published/20200121 Read Reddit from the Linux terminal.md b/published/202002/20200121 Read Reddit from the Linux terminal.md similarity index 100% rename from published/20200121 Read Reddit from the Linux terminal.md rename to published/202002/20200121 Read Reddit from the Linux terminal.md diff --git a/published/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md b/published/202002/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md similarity index 100% rename from published/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md rename to published/202002/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md diff --git a/published/20200122 Screenshot your Linux system configuration with Bash tools.md b/published/202002/20200122 Screenshot your Linux system configuration with Bash tools.md similarity index 100% rename from published/20200122 Screenshot your Linux system configuration with Bash tools.md rename to published/202002/20200122 Screenshot your Linux system configuration with Bash tools.md diff --git a/published/20200123 How to stop typosquatting attacks.md b/published/202002/20200123 How to stop typosquatting attacks.md similarity index 100% rename from published/20200123 How to stop typosquatting attacks.md rename to published/202002/20200123 How to stop typosquatting attacks.md diff --git a/published/20200123 Use this open source tool to get your local weather forecast.md b/published/202002/20200123 Use this open source tool to get your local weather forecast.md similarity index 100% rename from published/20200123 Use this open source tool to get your local weather forecast.md rename to published/202002/20200123 Use this open source tool to get your local weather forecast.md diff --git a/published/20200124 3 handy command-line internet speed tests.md b/published/202002/20200124 3 handy command-line internet speed tests.md similarity index 100% rename from published/20200124 3 handy command-line internet speed tests.md rename to published/202002/20200124 3 handy command-line internet speed tests.md diff --git a/published/20200124 Run multiple consoles at once with this open source window environment.md b/published/202002/20200124 Run multiple consoles at once with this open source window environment.md similarity index 100% rename from published/20200124 Run multiple consoles at once with this open source window environment.md rename to published/202002/20200124 Run multiple consoles at once with this open source window environment.md diff --git a/published/20200125 Use tmux to create the console of your dreams.md b/published/202002/20200125 Use tmux to create the console of your dreams.md similarity index 100% rename from published/20200125 Use tmux to create the console of your dreams.md rename to published/202002/20200125 Use tmux to create the console of your dreams.md diff --git a/published/20200126 Use Vim to send email and check your calendar.md b/published/202002/20200126 Use Vim to send email and check your calendar.md similarity index 100% rename from published/20200126 Use Vim to send email and check your calendar.md rename to published/202002/20200126 Use Vim to send email and check your calendar.md diff --git a/published/20200126 What-s your favorite Linux distribution.md b/published/202002/20200126 What-s your favorite Linux distribution.md similarity index 100% rename from published/20200126 What-s your favorite Linux distribution.md rename to published/202002/20200126 What-s your favorite Linux distribution.md diff --git a/published/20200127 Use Vim to manage your task list and access Reddit and Twitter.md b/published/202002/20200127 Use Vim to manage your task list and access Reddit and Twitter.md similarity index 100% rename from published/20200127 Use Vim to manage your task list and access Reddit and Twitter.md rename to published/202002/20200127 Use Vim to manage your task list and access Reddit and Twitter.md diff --git a/published/20200128 Send email and check your calendar with Emacs.md b/published/202002/20200128 Send email and check your calendar with Emacs.md similarity index 100% rename from published/20200128 Send email and check your calendar with Emacs.md rename to published/202002/20200128 Send email and check your calendar with Emacs.md diff --git a/published/20200129 4 cool new projects to try in COPR for January 2020.md b/published/202002/20200129 4 cool new projects to try in COPR for January 2020.md similarity index 100% rename from published/20200129 4 cool new projects to try in COPR for January 2020.md rename to published/202002/20200129 4 cool new projects to try in COPR for January 2020.md diff --git a/published/20200129 Joplin- The True Open Source Evernote Alternative.md b/published/202002/20200129 Joplin- The True Open Source Evernote Alternative.md similarity index 100% rename from published/20200129 Joplin- The True Open Source Evernote Alternative.md rename to published/202002/20200129 Joplin- The True Open Source Evernote Alternative.md diff --git a/published/20200129 Showing memory usage in Linux by process and user.md b/published/202002/20200129 Showing memory usage in Linux by process and user.md similarity index 100% rename from published/20200129 Showing memory usage in Linux by process and user.md rename to published/202002/20200129 Showing memory usage in Linux by process and user.md diff --git a/published/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md b/published/202002/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md similarity index 100% rename from published/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md rename to published/202002/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md diff --git a/published/20200131 Intro to the Linux command line.md b/published/202002/20200131 Intro to the Linux command line.md similarity index 100% rename from published/20200131 Intro to the Linux command line.md rename to published/202002/20200131 Intro to the Linux command line.md diff --git a/published/20200202 4 Key Changes to Look Out for in Linux Kernel 5.6.md b/published/202002/20200202 4 Key Changes to Look Out for in Linux Kernel 5.6.md similarity index 100% rename from published/20200202 4 Key Changes to Look Out for in Linux Kernel 5.6.md rename to published/202002/20200202 4 Key Changes to Look Out for in Linux Kernel 5.6.md diff --git a/published/20200203 Give an old MacBook new life with Linux.md b/published/202002/20200203 Give an old MacBook new life with Linux.md similarity index 100% rename from published/20200203 Give an old MacBook new life with Linux.md rename to published/202002/20200203 Give an old MacBook new life with Linux.md diff --git a/published/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md b/published/202002/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md similarity index 100% rename from published/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md rename to published/202002/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md diff --git a/published/20200204 Ubuntu 19.04 Has Reached End of Life- Existing Users Must Upgrade to Ubuntu 19.10.md b/published/202002/20200204 Ubuntu 19.04 Has Reached End of Life- Existing Users Must Upgrade to Ubuntu 19.10.md similarity index 100% rename from published/20200204 Ubuntu 19.04 Has Reached End of Life- Existing Users Must Upgrade to Ubuntu 19.10.md rename to published/202002/20200204 Ubuntu 19.04 Has Reached End of Life- Existing Users Must Upgrade to Ubuntu 19.10.md diff --git a/published/20200205 Getting started with GnuCash.md b/published/202002/20200205 Getting started with GnuCash.md similarity index 100% rename from published/20200205 Getting started with GnuCash.md rename to published/202002/20200205 Getting started with GnuCash.md diff --git a/published/20200206 3 ways to use PostgreSQL commands.md b/published/202002/20200206 3 ways to use PostgreSQL commands.md similarity index 100% rename from published/20200206 3 ways to use PostgreSQL commands.md rename to published/202002/20200206 3 ways to use PostgreSQL commands.md diff --git a/published/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md b/published/202002/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md similarity index 100% rename from published/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md rename to published/202002/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md diff --git a/published/20200207 Connect Fedora to your Android phone with GSConnect.md b/published/202002/20200207 Connect Fedora to your Android phone with GSConnect.md similarity index 100% rename from published/20200207 Connect Fedora to your Android phone with GSConnect.md rename to published/202002/20200207 Connect Fedora to your Android phone with GSConnect.md diff --git a/published/20200207 Customize your internet with an open source search engine.md b/published/202002/20200207 Customize your internet with an open source search engine.md similarity index 100% rename from published/20200207 Customize your internet with an open source search engine.md rename to published/202002/20200207 Customize your internet with an open source search engine.md diff --git a/published/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md b/published/202002/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md similarity index 100% rename from published/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md rename to published/202002/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md diff --git a/published/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md b/published/202002/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md similarity index 100% rename from published/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md rename to published/202002/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md diff --git a/published/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md b/published/202002/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md similarity index 100% rename from published/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md rename to published/202002/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md diff --git a/published/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md b/published/202002/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md similarity index 100% rename from published/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md rename to published/202002/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md diff --git a/published/20200210 Scan Kubernetes for errors with KRAWL.md b/published/202002/20200210 Scan Kubernetes for errors with KRAWL.md similarity index 100% rename from published/20200210 Scan Kubernetes for errors with KRAWL.md rename to published/202002/20200210 Scan Kubernetes for errors with KRAWL.md diff --git a/published/20200210 Top hacks for the YaCy open source search engine.md b/published/202002/20200210 Top hacks for the YaCy open source search engine.md similarity index 100% rename from published/20200210 Top hacks for the YaCy open source search engine.md rename to published/202002/20200210 Top hacks for the YaCy open source search engine.md diff --git a/published/20200211 Dino is a Modern Looking Open Source XMPP Client.md b/published/202002/20200211 Dino is a Modern Looking Open Source XMPP Client.md similarity index 100% rename from published/20200211 Dino is a Modern Looking Open Source XMPP Client.md rename to published/202002/20200211 Dino is a Modern Looking Open Source XMPP Client.md diff --git a/published/20200212 How to Change the Default Terminal in Ubuntu.md b/published/202002/20200212 How to Change the Default Terminal in Ubuntu.md similarity index 100% rename from published/20200212 How to Change the Default Terminal in Ubuntu.md rename to published/202002/20200212 How to Change the Default Terminal in Ubuntu.md diff --git a/published/20200212 How to use byobu to multiplex SSH sessions.md b/published/202002/20200212 How to use byobu to multiplex SSH sessions.md similarity index 100% rename from published/20200212 How to use byobu to multiplex SSH sessions.md rename to published/202002/20200212 How to use byobu to multiplex SSH sessions.md diff --git a/published/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md b/published/202002/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md similarity index 100% rename from published/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md rename to published/202002/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md diff --git a/published/20200213 Why developers like to code at night.md b/published/202002/20200213 Why developers like to code at night.md similarity index 100% rename from published/20200213 Why developers like to code at night.md rename to published/202002/20200213 Why developers like to code at night.md diff --git a/published/20200214 Digging up IP addresses with the Linux dig command.md b/published/202002/20200214 Digging up IP addresses with the Linux dig command.md similarity index 100% rename from published/20200214 Digging up IP addresses with the Linux dig command.md rename to published/202002/20200214 Digging up IP addresses with the Linux dig command.md diff --git a/published/20200217 How to get MongoDB Server on Fedora.md b/published/202002/20200217 How to get MongoDB Server on Fedora.md similarity index 100% rename from published/20200217 How to get MongoDB Server on Fedora.md rename to published/202002/20200217 How to get MongoDB Server on Fedora.md diff --git a/published/20200217 How to install Vim plugins.md b/published/202002/20200217 How to install Vim plugins.md similarity index 100% rename from published/20200217 How to install Vim plugins.md rename to published/202002/20200217 How to install Vim plugins.md diff --git a/published/20200219 Don-t like IDEs- Try grepgitvi.md b/published/202002/20200219 Don-t like IDEs- Try grepgitvi.md similarity index 100% rename from published/20200219 Don-t like IDEs- Try grepgitvi.md rename to published/202002/20200219 Don-t like IDEs- Try grepgitvi.md diff --git a/published/20200219 How Kubernetes Became the Standard for Compute Resources.md b/published/202002/20200219 How Kubernetes Became the Standard for Compute Resources.md similarity index 100% rename from published/20200219 How Kubernetes Became the Standard for Compute Resources.md rename to published/202002/20200219 How Kubernetes Became the Standard for Compute Resources.md diff --git a/published/20200219 How to Install Latest Git Version on Ubuntu.md b/published/202002/20200219 How to Install Latest Git Version on Ubuntu.md similarity index 100% rename from published/20200219 How to Install Latest Git Version on Ubuntu.md rename to published/202002/20200219 How to Install Latest Git Version on Ubuntu.md diff --git a/published/20200220 Using Python and GNU Octave to plot data.md b/published/202002/20200220 Using Python and GNU Octave to plot data.md similarity index 100% rename from published/20200220 Using Python and GNU Octave to plot data.md rename to published/202002/20200220 Using Python and GNU Octave to plot data.md From b91025ef63069c41651cb551bb9477ca26d71ed1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Mar 2020 12:23:41 +0800 Subject: [PATCH 153/260] PRF @wxy --- translated/tech/20200220 Tools for SSH key management.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translated/tech/20200220 Tools for SSH key management.md b/translated/tech/20200220 Tools for SSH key management.md index 0c9efe9752..be784e5b25 100644 --- a/translated/tech/20200220 Tools for SSH key management.md +++ b/translated/tech/20200220 Tools for SSH key management.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Tools for SSH key management) @@ -12,7 +12,7 @@ SSH 密钥管理工具 > 常用开源工具的省时快捷方式。 -![collection of hardware on blue backround][1] +![](https://img.linux.net.cn/data/attachment/album/202003/01/122336zyldgpse6eyrbymt.jpg) 我经常使用 SSH。我发现自己每天都要登录多个服务器和树莓派(与我位于同一房间,并接入互联网)。我有许多设备需要访问,并且获得访问权限的要求也不同,因此,除了使用各种 `ssh` / `scp` 命令选项之外,我还必须维护一个包含所有连接详细信息的配置文件。 @@ -60,7 +60,7 @@ $ ssh-import-id gh:waveform80 $ sudo pip3 install stormssh ``` -然后,你可以使用以下命令将 SSH 连接添加到配置中: +然后,你可以使用以下命令将 SSH 连接信息添加到配置中: ``` $ storm add pi3 pi@192.168.1.20 @@ -94,7 +94,7 @@ via: https://opensource.com/article/20/2/ssh-tools 作者:[Ben Nuttall][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 40b1c746562cb201e8b41e30c06fabfd20cb3784 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Mar 2020 12:24:10 +0800 Subject: [PATCH 154/260] PUB @wxy https://linux.cn/article-11947-1.html --- .../20200220 Tools for SSH key management.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200220 Tools for SSH key management.md (98%) diff --git a/translated/tech/20200220 Tools for SSH key management.md b/published/20200220 Tools for SSH key management.md similarity index 98% rename from translated/tech/20200220 Tools for SSH key management.md rename to published/20200220 Tools for SSH key management.md index be784e5b25..9331cf701f 100644 --- a/translated/tech/20200220 Tools for SSH key management.md +++ b/published/20200220 Tools for SSH key management.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11947-1.html) [#]: subject: (Tools for SSH key management) [#]: via: (https://opensource.com/article/20/2/ssh-tools) [#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) From a785bde73f56b6dc99a8e33f7d5cceafe9956c8a Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Sun, 1 Mar 2020 17:47:09 +0800 Subject: [PATCH 155/260] Translated --- ...r writing an effective technical resume.md | 74 ------------------- ...r writing an effective technical resume.md | 71 ++++++++++++++++++ 2 files changed, 71 insertions(+), 74 deletions(-) delete mode 100644 sources/talk/20200225 7 tips for writing an effective technical resume.md create mode 100644 translated/talk/20200225 7 tips for writing an effective technical resume.md diff --git a/sources/talk/20200225 7 tips for writing an effective technical resume.md b/sources/talk/20200225 7 tips for writing an effective technical resume.md deleted file mode 100644 index d91ab742d3..0000000000 --- a/sources/talk/20200225 7 tips for writing an effective technical resume.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (7 tips for writing an effective technical resume) -[#]: via: (https://opensource.com/article/20/2/technical-resume-writing) -[#]: author: (Emily Brand https://opensource.com/users/emily-brand) - -7 tips for writing an effective technical resume -====== -Present yourself in the best light to potential employers by following -these essentials. -![Two hands holding a resume with computer, clock, and desk chair ][1] - -If you're a software engineer or a manager in the technology sector, creating or updating your resume can be a daunting task. What is most important to consider? How should you handle the formatting, the content, and your objective or summary? What work experience is relevant? How can you make sure automated recruitment tools don't filter out your resume? - -As a hiring manager over the last seven years, I have seen a wide range of resumes and CVs; while some have been impressive, many more have been terribly written. - -When writing or updating your resume, here are seven easy rules to follow. - -### 1\. Summary statement - -The short paragraph at the top of your resume should be clean and concise, have a clear purpose, and avoid excessive use of adjectives and adverbs. Words such as "impressive," "extensive," and "excellent" do not improve your hiring chances; instead, they look and feel like overused filler words. An important question to ask yourself regarding your objective is: **Does it tell the hiring manager what kind of job I'm looking for and how I can provide value to them?** If not, either strengthen and streamline it to answer that question or leave it out altogether. - -### 2\. Work experience - -Numbers, numbers, numbers. Hard facts help you convey your point far more than general statements such as "Helped build, manage, deliver many projects that directly contributed to my customers' bottom line." Your wording should include statistics such as "Directly impacted five projects with top banks that accelerated their time to market by 40%," how many lines of code you committed, or how many teams you managed. Data is far more effective than frilly language to showcase your abilities and value. - -If you are less-experienced and have fewer jobs to showcase, do not include irrelevant experience like part-time summer jobs. Instead, add detail about the specifics of your relevant experience and what you learned that would make you a better employee for the organization you are applying for. - -### 3\. Search terms and jargon - -With technology playing such a huge role in the hiring process, it is extremely important to make sure your resume gets flagged for the right positions—but do not oversell yourself on your resume. If you mention agile skills but do not know what kanban is, think twice. If you mention that you are skilled in Java but haven't used it in five years, beware. If there are languages and frameworks you are familiar with but not necessarily current in, create a different category or divide your experience into "proficient in" and "familiar with." - -### 4\. Education - -If you are not a recent college graduate, there is no need to include your GPA or the clubs or fraternities you participated in, unless you plan on using them as talking points to gain trust during an interview. Be sure that anything you have published or patented is included, even if it is not relevant to the job. If you do not have a college degree, add a certification section in place of education. If you were in the military, include your active duty and reserve time. - -### 5\. Certifications - -Do not include expired certifications unless you are trying to re-enter a field you have left, such as if you were a people manager and are now looking to get back into hands-on programming. If you have certifications that are no longer relevant to the field, do not include them since it can be distracting and unappealing. Leverage your LinkedIn profile to add more color to your resume, as most people will read your resume and your LinkedIn profile before they interview you. - -### 6\. Spelling and grammar - -Ask others to proofread your resume. So often, I have seen misspelled words in a resume or mistaken uses of words like their, they're, and there. These are avoidable and fixable errors that will create a negative impression. Ideally, your resume will be in active tense, but if that makes you uncomfortable, write it in past tense—the most important thing is to maintain a consistent tense throughout. Improper spelling and grammar will convey that you either do not really care about the job you are applying for or do not have the level of attention to detail necessary for the job. - -### 7\. Formatting - -Ensuring your resume looks up-to-date and appealing is an easy way to make a good first impression. Ensuring consistent formatting, e.g., similar margins, similar spacing, capitalization, and colors (but keep color palettes to a minimum) is the most mundane part of resume writing, but it's necessary to show that you take pride in your work and value yourself and your future employer. Use tables where appropriate to space information in a visually appealing way. If given the option, upload your resume in .pdf and .docx formats, and Google Docs exports to the .odt format, which can be opened easily in LibreOffice. Here is an easy Google Docs [resume template][2] that I recommend. You can also purchase templates from companies that do attractive designs for a small fee (under $10). - -### Update regularly - -Updating your resume regularly will minimize your stress if you're asked to (or want to) apply for a job, and it will help you create and maintain a more accurate version of yourself. When working on your resume, be forward-thinking and be sure to ask at least three other people to review it for content, spelling, and grammar. Even if you are recruited by or referred to a company, your interviewers may know you only by your resume, so ensure that it creates a positive first impression of you. - -_Do you have additional tips to add?_ - -Emily Dunham shares her technique for leveraging open source contributions to stand out as a great... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/technical-resume-writing - -作者:[Emily Brand][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/emily-brand -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/resume_career_document_general.png?itok=JEaFL2XI (Two hands holding a resume with computer, clock, and desk chair ) -[2]: https://docs.google.com/document/d/1ARVyybC5qQEiCzUOLElwAdPpKOK0Qf88srr682eHdCQ/edit diff --git a/translated/talk/20200225 7 tips for writing an effective technical resume.md b/translated/talk/20200225 7 tips for writing an effective technical resume.md new file mode 100644 index 0000000000..20f7edf8f1 --- /dev/null +++ b/translated/talk/20200225 7 tips for writing an effective technical resume.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 tips for writing an effective technical resume) +[#]: via: (https://opensource.com/article/20/2/technical-resume-writing) +[#]: author: (Emily Brand https://opensource.com/users/emily-brand) + +撰写有效技术简历的7个技巧 +====== +遵循以下这些要点,把自己最好的一面呈现给潜在雇主。 +![Two hands holding a resume with computer, clock, and desk chair ][1] + +如果你是一名软件工程师或技术领域的经理,那么创建或更新简历可能是一项艰巨的任务。 要考虑的重点是什么? 应该怎么处理格式,内容以及目标或摘要? 哪些工作经验相关? 如何确保自动招聘工具不会过滤掉你的简历? + +在过去的七年中,作为一名招聘经理,我看到了各种各样的简历; 尽管有些令人印象深刻,但还有很多人写的很糟糕。 + +在编写或更新简历时,请遵循以下七个简单原则。 + +### 1\. 概述 + +简历顶部的简短段落应简洁明了,目的明确,避免过多使用形容词和副词。 诸如“令人印象深刻”,“广泛”和“优秀”之类的词,这些词不会增加你的招聘机会; 相反,它们看起来和感觉上像是过度使用的填充词。 关于你的目标,问自己一个重要的问题: **它是否告诉招聘经理我正在寻找什么样的工作以及如何为他们提供价值?** 如果不是,请加强并简化它以回答该问题,或者将其完全排除在外。 + +### 2\. 工作经验 + +数字,数字,数字。 用事实传达观点远比一般的陈述,例如“帮助构建,管理,交付许多对客户利润有贡献的项目” 更能对你有帮助。 你的表达中应包括统计数据,例如“直接影响了五个顶级银行的项目,这些项目将其上市时间缩短了40%”,你提交了多少行代码或管理了几个团队。 数据比修饰语更能有效地展示你的能力和价值。 + +如果你经验不足,没有什么工作经验可展示,那无关的经验,如暑期兼职工作,就不要写了。 相反,将相关经验的细节以及你所学到的知识的详细信息写进简历,这些可以使你成为一个更好的候选人。 + +### 3\. 搜索术语和行话 + +随着技术在招聘过程中发挥如此巨大的作用,确保简历被标记为正确的职位非常重要,但不要在简历上过分吹嘘自己。 如果你提到敏捷技能但不知道看板是什么,请三思。 如果你提到自己精通Java,但是已经有五年都没有使用过Java了,请小心。 如果存在你熟悉但不一定是最新的语言和框架,请创建其他类别或将你的经验分为“精通”和“熟悉”。 + +### 4\. 教育 + +如果你不是应届大学毕业生,那就没必要再写你的GPA或你参加过的俱乐部或兄弟会,除非你计划将它们用作谈话要点以在面试中赢得信任。 确保你发表的或获取过专利的东西包括在内,即使与你的工作无关。 如果你没有大学学位,请添加一个证书部分代替教育背景部分。 如果你是军人,请包括现役和预备时间。 + +### 5\. 资质证书 + +除非你想重新进入之前离开的领域,否则不要写过期的证书,例如,如果你曾经是一名人事经理,而现在正寻求动手编程的工作。 如果你拥有与该领域不再相关的认证,就不要写这些认证,因为这些可能会分散招聘者的注意力,使你的简历失去吸引力。 利用你的 LinkedIn 个人资料为简历添加更多色彩,因为大多数人在面试之前都会阅读你的简历和 LinkedIn 个人资料。 + +### 6\. 拼写和语法 + + +让其他人对你的简历进行校对。 很多时候,我在简历中看到拼写错误的单词,或者错误用词,如“他们的”、“他们是”、“那些”。 这些可以避免和修复的错误会产生负面影响。 理想情况下,你的简历应用主动语态,但是如果这样会使你感到不舒服,那么就用过去时书写-最重要的是要始终保持一致。 不正确的拼写和语法会传递你要么不是很在乎所申请的工作,要么没有足够注意细节。 + +### 7\. 格式 + +确保你的简历是最新的并且富有吸引力,这是留下良好第一印象的简便方法。 确保格式一致,例如相同的页边距,相同的间距,大写字母和颜色(将调色板保持在最低水平)是简历写作中最基本的部分,但有必要表明你对工作感到豪感,并重视自己的价值和未来的雇主。 在适当的地方使用表格,以视觉吸引人的方式分配信息。 如果有给定模板,以 .pdf 和 .docx 格式上传简历,然后用 Google Docs 导出为 .odt 格式,这样可以在 LibreOffice 中轻松打开。 这是我推荐的简单的 Google 文档简历模板。 你还可以支付少量费用(不到10美元)从一些设计公司购买。 + +### 定期更新 + +如果你被要求(或希望)申请一份工作,定期更新简历可以最大程度地减少压力,也可以帮助你创建和维护更准确的简历版本。 撰写简历时,要有远见,确保至少让其他三个人对你的简历内容,拼写和语法进行检查。 即使你是由公司招募或其他人推荐给公司的,面试官也可能仅通过简历认识你,因此请确保它为你带来良好的第一印象。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/technical-resume-writing + +作者:[Emily Brand][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/emily-brand +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/resume_career_document_general.png?itok=JEaFL2XI (Two hands holding a resume with computer, clock, and desk chair ) +[2]: https://docs.google.com/document/d/1ARVyybC5qQEiCzUOLElwAdPpKOK0Qf88srr682eHdCQ/edit From 9c574bbcc0dffe3b2bc92fa2c83e46ca9c83de82 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 2 Mar 2020 00:55:58 +0800 Subject: [PATCH 156/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200302=20How=20?= =?UTF-8?q?to=20Add=20New=20Brushes=20in=20GIMP=20[Quick=20Tip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md --- ...w to Add New Brushes in GIMP -Quick Tip.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md diff --git a/sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md b/sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md new file mode 100644 index 0000000000..6443a00482 --- /dev/null +++ b/sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Add New Brushes in GIMP [Quick Tip]) +[#]: via: (https://itsfoss.com/add-brushes-gimp/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +How to Add New Brushes in GIMP [Quick Tip] +====== + +[GIMP][1], is the most popular free and open-source image editor and perhaps the best [Adobe Photoshop alternative][2] on Linux. + +When you [install GIMP on Ubuntu][3] or any other operating system, you’ll find a few brushes already installed for basic image editing. If you need something more specific, you can always add new brushes in GIMP. + +How? Let me show you that in this quick tutorial. + +### How to add brushes in GIMP + +![][4] + +There are three steps involved in installing new brushes in GIMP: + + * Get new brush + * Put it in the designated folder + * Refresh the brushes in GIMP + + + +#### Step 1: Download new GIMP brushes + +The first step is to get new brushes for GIMP. Where do you get it from? From the internet, of course. + +You can search on Google or [alternative private search engines like Duck Duck Go][5] for ‘GIMP brushes’ and download the ones you like from a reputed website. + +GIMP brushes are usually available in .gbr and .gih file formats. The .gbr file is for regular brushes while .gih is used for animated brushes. + +Did you know? + +For the versions 2.4 and above, GIMP makes installing and using Photoshop brushes (.abr file) quite straightforward. All you need to do is place the Photoshop brush files in the proper folder. +Do keep in mind that the latest Photoshop brushes might not work with GIMP flawlessly. + +#### Step 2: Copy the new brushes into its location + +After you get your brush file, the next step is to copy and paste it to the right folder in GIMP configuration directory. + +On **Windows**, you’ll have to go to a folder like “**C:\Documents and Settings\myusername.gimp-2.10\brushes**“. + +I’ll show detailed steps for **Linux** because It’s FOSS is a Linux-focused website. + +After selecting the brush files press **Ctrl+h** in your **Home** folder to [see hidden files in Linux][6]. + +![Press Ctrl+H to see hidden files in the home directory][7] + +You should go to **.config/GIMP/2.10/brushes** folder (if you are using GIMP version 2.10). If you are using some other version, you should see an equivalent folder under .config/GIMP. + +![Adding New Brushes in GIMP][8] + +Paste the brush files in this folder. Optionally, you can hide the hidden files by pressing **Ctrl+h** again. + +#### Step 3: Refresh the brushes (to avoid restarting GIMP) + +GIMP will automatically load brushes when it’s launched. If you are already running it and don’t want to close it, you can refresh the brushes. + +In GIMP go to **Windows**->**Dockable Dialogues**->**Brushes** in the main menu. + +![Refresh GIMP Brushes by going go to Windows->Dockable Dialogues-> Brushes][9] + +Locate the **refresh** icon in the **Brushes** dialog on the right side bar. + +![Refresh GIMP Brushes][10] + +If your brushes are not present, you can always try to restart GIMP. + +Bonus Tip! + +Adding new brushes in [GIMP also allows you easily watermark images][11]. Just use your logo as a brush and add it to the images in a single click. + +I hope you enjoyed this quick GIMP tip. Stay tuned for more. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/add-brushes-gimp/ + +作者:[Community][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/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://itsfoss.com/open-source-photoshop-alternatives/ +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Install-New-Brushes-in-GIMP.jpg?ssl=1 +[5]: https://itsfoss.com/privacy-search-engines/ +[6]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/adding-brushes-GIMP-1.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/adding-brushes-GIMP.png?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/Refresh-GIMP-Brushes.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/Refresh-GIMP-Brushes-2.jpg?ssl=1 +[11]: https://itsfoss.com/add-watermark-gimp-linux/ From aa5987badd1b4d3514eb0fb955a3f64b56ec3593 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 2 Mar 2020 08:28:44 +0800 Subject: [PATCH 157/260] translated --- ...oud with Fedora 31 and Nextcloud Server.md | 60 +++++++++---------- 1 file changed, 29 insertions(+), 31 deletions(-) rename {sources => translated}/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md (63%) diff --git a/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md b/translated/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md similarity index 63% rename from sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md rename to translated/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md index 5aa4ee5023..c5cd454f7d 100644 --- a/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md +++ b/translated/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md @@ -7,57 +7,57 @@ [#]: via: (https://fedoramagazine.org/build-your-own-cloud-with-fedora-31-and-nextcloud-server/) [#]: author: (storyteller https://fedoramagazine.org/author/storyteller/) -Build your own cloud with Fedora 31 and Nextcloud Server +使用 Fedora 31 和 Nextcloud 服务器构建自己的云 ====== ![][1] -[Nextcloud][2] is a software suite for storing and syncing your data across multiple devices. You can learn more about Nextcloud Server’s features from [https://github.com/nextcloud/server][3]. +[Nextcloud][2] 是用于跨多个设备存储和同步数据的软件套件。你可以从 [https://github.com/nextcloud/server][3] 了解有关 Nextcloud 服务器的更多特性信息。 -This article demonstrates how to build a personal cloud using Fedora and Nextcloud in a few simple steps. For this tutorial you will need a dedicated computer or a virtual machine running Fedora 31 server edition and an internet connection. +本文通过几个简单的步骤演示了如何使用 Fedora 和 Nextcloud 构建个人云。对于本教程,你将需要一台独立计算机或运行 Fedora 31 服务器版的虚拟机,还需要互联网连接。 -### Step 1: Install the prerequisites +### 步骤 1:预先安装条件 -Before installing and configuring Nextcloud, a few prerequisites must be satisfied. +在安装和配置 Nextcloud 之前,必须满足一些预先条件。 -First, install Apache web server: +首先,安装 Apache Web 服务器: ``` # dnf install httpd ``` -Next, install PHP and some additional modules. Make sure that the PHP version being installed meets [Nextcloud’s requirements][4]: +接下来,安装 PHP 和一些其他模块。确保所安装的 PHP 版本符合 [Nextcloud 的要求][4]: ``` # dnf install php php-gd php-mbstring php-intl php-pecl-apcu php-mysqlnd php-pecl-redis php-opcache php-imagick php-zip php-process ``` -After PHP is installed enable and start the Apache web server: +安装 PHP 后,启用并启动 Apache Web 服务器: ``` # systemctl enable --now httpd ``` -Next, allow _HTTP_ traffic through the firewall: +接下来,允许 _HTTP_ 流量穿过防火墙: ``` # firewall-cmd --permanent --add-service=http # firewall-cmd --reload ``` -Next, install the MariaDB server and client: +接下来,安装 MariaDB 服务器和客户端: ``` # dnf install mariadb mariadb-server ``` -Then enable and start the MariaDB server: +然后启用并启动 MariaDB 服务器 ``` # systemctl enable --now mariadb ``` -Now that MariaDB is running on your server, you can run the _mysql_secure_installation_ command to secure it: +现在,MariaDB 正在运行,你可以运行 _mysql_secure_installation_ 命令来保护它: ``` # mysql_secure_installation @@ -128,7 +128,7 @@ MariaDB installation should now be secure. Thanks for using MariaDB! ``` -Next, create a dedicated user and database for your Nextcloud instance: +接下来,为你的 Nextcloud 实例创建独立的用户和数据库: ``` # mysql -p @@ -139,23 +139,23 @@ Next, create a dedicated user and database for your Nextcloud instance: > exit; ``` -### Step 2: Install Nextcloud Server +### 步骤 2:安装 Nextcloud 服务器 -Now that the prerequisites for your Nextcloud installation have been satisfied, download and unzip [the Nextcloud archive][5]: +现在,你已满足 Nextcloud 安装的预先条件,请下载并解压 [Nextcloud 压缩包][5]: ``` # wget https://download.nextcloud.com/server/releases/nextcloud-17.0.2.zip # unzip nextcloud-17.0.2.zip -d /var/www/html/ ``` -Next, create a data folder and grant Apache read and write access to the _nextcloud_ directory tree: +接下来,创建一个数据文件夹,并授予 Apache 对 _nextcloud_ 目录树的读写访问权限: ``` # mkdir /var/www/html/nextcloud/data # chown -R apache:apache /var/www/html/nextcloud ``` -SELinux must be configured to work with Nextcloud. The basic commands are those bellow, but a lot more, by features used on nexcloud installation, are posted here: [Nextcloud SELinux configuration][6] +SELinux 必须配置为可与 Nextcloud 一起使用。基本命令如下所示,但在 nexcloud 安装中还有很多其他的命令,发布在这里:[Nextcloud SELinux 配置][6] ``` # semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?' @@ -166,30 +166,30 @@ SELinux must be configured to work with Nextcloud. The basic commands are those # restorecon -Rv '/var/www/html/nextcloud/' ``` -### Step 3: Configure N**extclou**d +### 步骤 3:配置 Nextcloud -Nextcloud can be configured using its web interface or from the command line. +可以使用它的 Web 界面或在命令行配置 Nextcloud。 -#### Using the web interface +#### 使用 Web 界面 -From your favorite browser, access __ and fill the fields: +在你喜欢的浏览器中,访问 __ 并输入字段: ![][7] -#### Using the command line +#### 使用命令行 -From the command line, just enter the following, substituting the values you used when you created a dedicated Nextcloud user in MariaDB earlier: +在命令行中,只需输入以下内容,使用你之前在 MariaDB 中创建的独立 Nextcloud 用户替换相应的值: ``` # sudo -u apache php occ maintenance:install --data-dir /var/www/html/nextcloud/data/ --database "mysql" --database-name "nextcloud" --database-user "nc_admin" --database-pass "DB_SeCuRe_PaSsWoRd" --admin-user "admin" --admin-pass "Admin_SeCuRe_PaSsWoRd" ``` -### Final Notes +### 最后几点 - * I used the _http_ protocol, but Nextcloud also works over _https_. I might write a follow-up about securing Nextcloud in a future article. - * I disabled SELinux, but your server will be more secure if you configure it. - * The recommend PHP memory limit for Nextcloud is 512M. To change it, edit the _memory_limit_ variable in the _/etc/php.ini_ configuration file and restart your _httpd_ service. - * By default, the web interface can only be accessed using the __ URL. If you want to allow access using other domain names, [you can do so by editing the _/var/www/html/nextcloud/config/config.php_ file][8]. The * character can be used to bypass the domain name restriction and allow the use of any URL that resolves to one of your server’s IP addresses. + * 我使用的是 _http_ 协议,但是 Nextcloud 也可以在 _https_ 上运行。我可能会在以后的文章中写一篇有关保护 Nextcloud 的文章。 +  * 我禁用了 SELinux,但是如果配置它,你的服务器将更加安全。 +  * Nextcloud 的建议 PHP 内存限制为 512M。要更改它,请编辑 _/etc/php.ini_ 配置文件中的 _memory_limit_ 变量,然后重新启动 _httpd_ 服务。 +  * 默认情况下,只能使用 __ URL 访问 Web 界面。如果要允许使用其他域名访问,[你可编辑 _/var/www/html/nextcloud/config/config.php_ 来进行此操作][8]。\* 字符可用于绕过域名限制,并允许任何解析为服务器 IP 的 URL 访问。 @@ -201,15 +201,13 @@ From the command line, just enter the following, substituting the values you use ), ``` -_— Updated on January 28th, 2020 to include SELinux configuration —_ - -------------------------------------------------------------------------------- via: https://fedoramagazine.org/build-your-own-cloud-with-fedora-31-and-nextcloud-server/ 作者:[storyteller][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/) 荣誉推出 From d1985dfa85a6178e5679dda0fea5b7758729b238 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 2 Mar 2020 08:34:10 +0800 Subject: [PATCH 158/260] translating --- .../tech/20200226 Use logzero for simple logging in Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200226 Use logzero for simple logging in Python.md b/sources/tech/20200226 Use logzero for simple logging in Python.md index 1fbd61b68f..467b30d968 100644 --- a/sources/tech/20200226 Use logzero for simple logging in Python.md +++ b/sources/tech/20200226 Use logzero for simple logging in Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 446b31046160a7375a66baaaba9f85bf2ce5a046 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 09:40:32 +0800 Subject: [PATCH 159/260] PUB @lujun9972 https://linux.cn/article-11949-1.html --- .../tech => published}/20170918 Fun and Games in Emacs.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20170918 Fun and Games in Emacs.md (99%) diff --git a/translated/tech/20170918 Fun and Games in Emacs.md b/published/20170918 Fun and Games in Emacs.md similarity index 99% rename from translated/tech/20170918 Fun and Games in Emacs.md rename to published/20170918 Fun and Games in Emacs.md index 9b547de0de..beb061fb1b 100644 --- a/translated/tech/20170918 Fun and Games in Emacs.md +++ b/published/20170918 Fun and Games in Emacs.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11949-1.html) [#]: subject: (Fun and Games in Emacs) [#]: via: (https://www.masteringemacs.org/article/fun-games-in-emacs) [#]: author: (Mickey Petersen https://www.masteringemacs.org/about) From 524627ce1e7587eb7d5e1aac1087a677d900894d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 09:55:49 +0800 Subject: [PATCH 160/260] PRF --- published/20170918 Fun and Games in Emacs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20170918 Fun and Games in Emacs.md b/published/20170918 Fun and Games in Emacs.md index beb061fb1b..2602ba804c 100644 --- a/published/20170918 Fun and Games in Emacs.md +++ b/published/20170918 Fun and Games in Emacs.md @@ -78,9 +78,9 @@ Emacs 中汉诺塔的实现可以追溯到 20 世纪 80 年代中期——确实 我喜欢 `fortune` 命令。每当我启动一个新 shell 时,这些与文学片段、谜语相结合的刻薄、无益、常常带有讽刺意味的“建议”就会点亮我的一天。 -令人困惑的是,Emacs 中有两个包或多或少地做着类似的事情:`fortune` 和 `cookie1`。前者主要用于在电子邮件签名中添加幸运饼干消息,而后者只是一个简单的 fortune 格式阅读器。 +令人困惑的是,Emacs 中有两个包或多或少地做着类似的事情:`fortune` 和 `cookie`。前者主要用于在电子邮件签名中添加幸运饼干消息,而后者只是一个简单的 fortune 格式阅读器。 -不管怎样,使用 Emacs 的 `cookie1` 包前,你首先需要通过 `customize-option RET cookie RET` 来自定义变量 `cookie-file` 告诉它从哪找到 fortune 文件。 +不管怎样,使用 Emacs 的 `cookie` 包前,你首先需要通过 `customize-option RET cookie RET` 来自定义变量 `cookie-file` 告诉它从哪找到 fortune 文件。 如果你的操作系统是 Ubuntu,那么你先安装 `fortune` 软件包,然后就能在 `/usr/share/games/fortune/` 目录中找到这些文件了。 From 63801b20077b070fea5cffc5e8e870a7f59df093 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 10:19:42 +0800 Subject: [PATCH 161/260] PRF @wxy --- ...200224 Using C and C-- for data science.md | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/translated/tech/20200224 Using C and C-- for data science.md b/translated/tech/20200224 Using C and C-- for data science.md index c2b3ca0a87..d6c30dec4b 100644 --- a/translated/tech/20200224 Using C and C-- for data science.md +++ b/translated/tech/20200224 Using C and C-- for data science.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Using C and C++ for data science) @@ -10,30 +10,29 @@ 在数据科学中使用 C 和 C++ ====== -> 让我们使用 C99 和 C++ 11 完成常见的数据科学任务。 +> 让我们使用 C99 和 C++11 完成常见的数据科学任务。 ![metrics and data shown on a computer screen][1] 虽然 [Python][2] 和 [R][3] 之类的语言在数据科学中越来越受欢迎,但是 C 和 C++ 对于高效的数据科学来说是一个不错的选择。在本文中,我们将使用 [C99][4] 和 [C++11][5] 编写一个程序,该程序使用 [Anscombe 的四重奏][6]数据集,下面将对其进行解释。 -我在一篇涉及 [Python 和 GNU Octave][7] 的文章中写了我不断学习语言的动机,值得大家回顾。所有程序都应在[命令行][8]上运行,而不是在[图形用户界面(GUI)][9]上运行。完整的示例可在 [polyglot_fit 存储库][10]中找到。 +我在一篇涉及 [Python 和 GNU Octave][7] 的文章中写了我不断学习编程语言的动机,值得大家回顾。这里所有的程序都需要在[命令行][8]上运行,而不是在[图形用户界面(GUI)][9]上运行。完整的示例可在 [polyglot_fit 存储库][10]中找到。 ### 编程任务 你将在本系列中编写的程序: -* 从 [CSV 文件] [11]中读取数据 +* 从 [CSV 文件][11]中读取数据 * 用直线插值数据(即 `f(x)=m ⋅ x + q`) * 将结果绘制到图像文件 -这是许多数据科学家遇到的普遍情况。示例数据是 [Anscombe 的四重奏] [6]的第一组,如下表所示。这是一组人工构建的数据,当拟合直线时可以提供相同的结果,但是它们的曲线非常不同。数据文件是一个文本文件,其中的制表符用作列分隔符,几行作为标题。该任务将仅使用第一组(即前两列)。 - -[Anscombe 的四重奏][6] +这是许多数据科学家遇到的普遍情况。示例数据是 [Anscombe 的四重奏][6]的第一组,如下表所示。这是一组人工构建的数据,当拟合直线时可以提供相同的结果,但是它们的曲线非常不同。数据文件是一个文本文件,其中的制表符用作列分隔符,前几行作为标题。该任务将仅使用第一组(即前两列)。 +![](https://img.linux.net.cn/data/attachment/album/202002/29/122805h3yrs1dkrgysssxk.png) ### C 语言的方式 -[C][12] 语言是通用编程语言,是当今使用最广泛的语言之一(依据 [TIOBE 榜单][13]、[RedMonk 编程语言排名][14]、[编程语言流行度榜单][15]和 [GitHub Octoverse 状态][16])。这是一种相当古老的语言(大约诞生在 1973 年),并且用它编写了许多成功的程序(例如 Linux 内核和 Git 仅是其中两个例子)。它也是最接近计算机内部运行的语言之一,因为它直接用于操作内存。它是一种[编译语言] [17];因此,源代码必须由[编译器][18]转换为[机器代码][19]。它的[标准库][20]很小,功能也不多,因此开发了其他库来提供缺少的功能。 +[C][12] 语言是通用编程语言,是当今使用最广泛的语言之一(依据 [TIOBE 指数][13]、[RedMonk 编程语言排名][14]、[编程语言流行度指数][15]和 [GitHub Octoverse 状态][16] 得来)。这是一种相当古老的语言(大约诞生在 1973 年),并且用它编写了许多成功的程序(例如 Linux 内核和 Git 仅是其中的两个例子)。它也是最接近计算机内部运行机制的语言之一,因为它直接用于操作内存。它是一种[编译语言][17];因此,源代码必须由[编译器][18]转换为[机器代码][19]。它的[标准库][20]很小,功能也不多,因此人们开发了其它库来提供缺少的功能。 我最常在[数字运算][21]中使用该语言,主要是因为其性能。我觉得使用起来很繁琐,因为它需要很多[样板代码][22],但是它在各种环境中都得到了很好的支持。C99 标准是最新版本,增加了一些漂亮的功能,并且得到了编译器的良好支持。 @@ -41,7 +40,7 @@ #### 安装 -要使用 C99 进行开发,你需要一个编译器。我通常使用 [Clang][23],不过 [GCC][24] 是另一个有效的开源编译器。对于线性拟合,我选择使用 [GNU 科学库] [25]。对于绘图,我找不到任何明智的库,因此该程序依赖于外部程序:[Gnuplot] [26]。该示例还使用动态数据结构来存储数据,该结构在[伯克利软件分发版(BSD)][27]中定义。 +要使用 C99 进行开发,你需要一个编译器。我通常使用 [Clang][23],不过 [GCC][24] 是另一个有效的开源编译器。对于线性拟合,我选择使用 [GNU 科学库][25]。对于绘图,我找不到任何明智的库,因此该程序依赖于外部程序:[Gnuplot][26]。该示例还使用动态数据结构来存储数据,该结构在[伯克利软件分发版(BSD)][27]中定义。 在 [Fedora][28] 中安装很容易: @@ -49,7 +48,7 @@ sudo dnf install clang gnuplot gsl gsl-devel ``` -#### 注释代码 +#### 代码注释 在 C99 中,[注释][29]的格式是在行的开头放置 `//`,行的其它部分将被解释器丢弃。另外,`/*` 和 `*/` 之间的任何内容也将被丢弃。 @@ -65,7 +64,7 @@ sudo dnf install clang gnuplot gsl gsl-devel * [头文件][30],其中包含函数说明 * 包含函数定义的源文件 -头文件包含在源文件中,而库文件的源文件则与可执行文件[链接][31]。因此,此示例所需的头文件是: +头文件包含在源文件中,而库文件的源文件则[链接][31]到可执行文件。因此,此示例所需的头文件是: ``` // 输入/输出功能 @@ -83,7 +82,7 @@ sudo dnf install clang gnuplot gsl gsl-devel #### 主函数 -在 C 语言中,程序必须位于称为主函数 [main()][32]:的特殊函数内: +在 C 语言中,程序必须位于称为主函数 [main()][32] 的特殊函数内: ``` int main(void) { @@ -95,7 +94,7 @@ int main(void) { #### 定义变量 -在 C 语言中,变量必须在使用前声明,并且必须与类型关联。每当你要使用变量时,都必须决定要在其中存储哪种数据。你也可以指定是否打算将变量用作常量值,这不是必需的,但是编译器可以从此信息中受益。 来自存储库中的 [fitting_C99.c 程序] [33]: +在 C 语言中,变量必须在使用前声明,并且必须与类型关联。每当你要使用变量时,都必须决定要在其中存储哪种数据。你也可以指定是否打算将变量用作常量值,这不是必需的,但是编译器可以从此信息中受益。 以下来自存储库中的 [fitting_C99.c 程序][33]: ``` const char *input_file_name = "anscombe.csv"; @@ -113,7 +112,7 @@ C 语言中的数组不是动态的,从某种意义上说,数组的长度必 int data_array[1024]; ``` -由于你通常不知道文件中有多少个数据点,因此请使用[单链接列表][34]。这是一个动态数据结构,可以无限增长。幸运的是,BSD [提供了链表][35]。这是一个示例定义: +由于你通常不知道文件中有多少个数据点,因此请使用[单链列表][34]。这是一个动态数据结构,可以无限增长。幸运的是,BSD [提供了链表][35]。这是一个示例定义: ``` struct data_point { @@ -145,7 +144,7 @@ printf("Slope: %f\n", slope); #### 读取数据 -现在来到了困难的部分……有一些用 C 语言解析 CSV 文件的库,但是似乎没有一个库足够稳定或流行到可以放入到 Fedora 软件包存储库中。我没有为本教程添加依赖项,而是决定自己编写此部分。同样,讨论这些细节太啰嗦了,所以我只会解释大致的思路。为了简洁起见,将忽略源代码中的某些行,但是你可以在存储库中找到完整的示例。 +现在来到了困难的部分……有一些用 C 语言解析 CSV 文件的库,但是似乎没有一个库足够稳定或流行到可以放入到 Fedora 软件包存储库中。我没有为本教程添加依赖项,而是决定自己编写此部分。同样,讨论这些细节太啰嗦了,所以我只会解释大致的思路。为了简洁起见,将忽略源代码中的某些行,但是你可以在存储库中找到完整的示例代码。 首先,打开输入文件: @@ -210,7 +209,7 @@ double *x = malloc(sizeof(double) * entries_number); double *y = malloc(sizeof(double) * entries_number); ``` -然后,遍历链接列表以将相关数据保存到数组: +然后,遍历链表以将相关数据保存到数组: ``` SLIST_FOREACH(datum, &head, entries) { @@ -224,7 +223,7 @@ SLIST_FOREACH(datum, &head, entries) { } ``` -现在你已经完成了链接列表,请清理它。要**总是**释放已手动分配的内存,以防止[内存泄漏][48]。内存泄漏是糟糕的、糟糕的、糟糕的(重要的话说三遍)。每次内存没有释放时,花园侏儒都会找不到自己的头: +现在你已经处理完了链表,请清理它。要**总是**释放已手动分配的内存,以防止[内存泄漏][48]。内存泄漏是糟糕的、糟糕的、糟糕的(重要的话说三遍)。每次内存没有释放时,花园侏儒都会找不到自己的头: ``` while (!SLIST_EMPTY(&head)) { @@ -278,7 +277,7 @@ plot 'fit_C99.csv' using 1:2 with lines title 'Fit', 'anscombe.csv' using 1:2 wi clang -std=c99 -I/usr/include/ fitting_C99.c -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_C99 ``` -这个命令告诉编译器使用 C99 标准,读取 `fitting_C99.c` 文件,加载 `gsl` 和 `gslcblas` 库,并将结果保存到 `fitting_C99`。命令行上的结果输出为: +这个命令告诉编译器使用 C99 标准、读取 `fitting_C99.c` 文件、加载 `gsl` 和 `gslcblas` 库、并将结果保存到 `fitting_C99`。命令行上的结果输出为: ``` #### Anscombe's first set with C99 #### @@ -287,13 +286,13 @@ Intercept: 3.000091 Correlation coefficient: 0.816421 ``` -这是用 Gnuplot 生成的结果图像。 +这是用 Gnuplot 生成的结果图像: ![Plot and fit of the dataset obtained with C99][52] ### C++11 方式 -[C++][53] 语言是一种通用编程语言,也是当今使用的最受欢迎的语言之一。它是作为 [C 的继承人][54]创建的(诞生于 1983 年),重点是[面向对象程序设计(OOP)][55]。C++ 通常被视为 C 的超集,因此 C 程序应该能够使用 C++ 编译器进行编译。这并非完全正确,因为在某些极端情况下它们的行为有所不同。 根据我的经验,C++ 比 C 需要更少的样板代码,但是如果要进行对象开发,语法会更困难。C++11 标准是最新版本,增加了一些漂亮的功能,并且或多或少得到了编译器的支持。 +[C++][53] 语言是一种通用编程语言,也是当今使用的最受欢迎的语言之一。它是作为 [C 的继承人][54]创建的(诞生于 1983 年),重点是[面向对象程序设计(OOP)][55]。C++ 通常被视为 C 的超集,因此 C 程序应该能够使用 C++ 编译器进行编译。这并非完全正确,因为在某些极端情况下它们的行为有所不同。 根据我的经验,C++ 与 C 相比需要更少的样板代码,但是如果要进行面向对象开发,语法会更困难。C++11 标准是最新版本,增加了一些漂亮的功能,并且基本上得到了编译器的支持。 由于 C++ 在很大程度上与 C 兼容,因此我将仅强调两者之间的区别。我在本部分中没有涵盖的任何部分,则意味着它与 C 中的相同。 @@ -309,7 +308,6 @@ sudo dnf install clang gnuplot gsl gsl-devel 库的工作方式与 C 语言相同,但是 `include` 指令略有不同: - ``` #include #include @@ -325,7 +323,7 @@ extern "C" { } ``` -由于 GSL 库是用 C 编写的,因此你必须将这种特殊性告知编译器。 +由于 GSL 库是用 C 编写的,因此你必须将这个特殊情况告知编译器。 #### 定义变量 @@ -429,17 +427,17 @@ Intercept: 3.00009 Correlation coefficient: 0.816421 ``` -这就是用 Gnuplot 生成的结果图像。 +这就是用 Gnuplot 生成的结果图像: ![Plot and fit of the dataset obtained with C++11][58] ### 结论 -本文提供了用 C99 和 C++11 编写的数据拟合和绘图任务的示例。由于 C++ 在很大程度上与 C 兼容,因此本文利用了它们的相似性来编写了第二个示例。在某些方面,C++ 更易于使用,因为它部分减轻了显式管理内存的负担。但是其语法更加复杂,因为它引入了为 OOP 编写类的可能性。但是,仍然可以用 C 使用 OOP 方法编写软件。由于 OOP 是一种编程风格,因此可以以任何语言使用。在 C 中有一些很好的 OOP 示例,例如 [GObject][59] 和 [Jansson][60]库。 +本文提供了用 C99 和 C++11 编写的数据拟合和绘图任务的示例。由于 C++ 在很大程度上与 C 兼容,因此本文利用了它们的相似性来编写了第二个示例。在某些方面,C++ 更易于使用,因为它部分减轻了显式管理内存的负担。但是其语法更加复杂,因为它引入了为 OOP 编写类的可能性。但是,仍然可以用 C 使用 OOP 方法编写软件。由于 OOP 是一种编程风格,因此可以在任何语言中使用。在 C 中有一些很好的 OOP 示例,例如 [GObject][59] 和 [Jansson][60]库。 对于数字运算,我更喜欢在 C99 中进行,因为它的语法更简单并且得到了广泛的支持。直到最近,C++11 还没有得到广泛的支持,我倾向于避免使用先前版本中的粗糙不足之处。对于更复杂的软件,C++ 可能是一个不错的选择。 -你是否也将 C 或 C++ 用于数据科学? 在评论中分享你的经验。 +你是否也将 C 或 C++ 用于数据科学?在评论中分享你的经验。 -------------------------------------------------------------------------------- @@ -448,7 +446,7 @@ via: https://opensource.com/article/20/2/c-data-science 作者:[Cristiano L. Fontana][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/) 荣誉推出 @@ -460,7 +458,7 @@ via: https://opensource.com/article/20/2/c-data-science [4]: https://en.wikipedia.org/wiki/C99 [5]: https://en.wikipedia.org/wiki/C%2B%2B11 [6]: https://en.wikipedia.org/wiki/Anscombe%27s_quartet -[7]: https://opensource.com/article/20/2/python-gnu-octave-data-science +[7]: https://linux.cn/article-11943-1.html [8]: https://en.wikipedia.org/wiki/Command-line_interface [9]: https://en.wikipedia.org/wiki/Graphical_user_interface [10]: https://gitlab.com/cristiano.fontana/polyglot_fit From 998fa6d8041271294c6dbb2bd1570bcc7f0709b5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 10:20:21 +0800 Subject: [PATCH 162/260] PUB @wxy https://linux.cn/article-11950-1.html --- .../20200224 Using C and C-- for data science.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200224 Using C and C-- for data science.md (99%) diff --git a/translated/tech/20200224 Using C and C-- for data science.md b/published/20200224 Using C and C-- for data science.md similarity index 99% rename from translated/tech/20200224 Using C and C-- for data science.md rename to published/20200224 Using C and C-- for data science.md index d6c30dec4b..f1dfdce174 100644 --- a/translated/tech/20200224 Using C and C-- for data science.md +++ b/published/20200224 Using C and C-- for data science.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11950-1.html) [#]: subject: (Using C and C++ for data science) [#]: via: (https://opensource.com/article/20/2/c-data-science) [#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) From 69f04a92a8c9f3d4f555086a0b4a503119dc5e1e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 20:02:01 +0800 Subject: [PATCH 163/260] APL --- .../20200212 Extend the life of your SSD drive with fstrim.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200212 Extend the life of your SSD drive with fstrim.md b/sources/tech/20200212 Extend the life of your SSD drive with fstrim.md index c8108d68c9..18af55a6d0 100644 --- a/sources/tech/20200212 Extend the life of your SSD drive with fstrim.md +++ b/sources/tech/20200212 Extend the life of your SSD drive with fstrim.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 665f2f083cd647d127969f4dc4baae907ad7e924 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 20:36:59 +0800 Subject: [PATCH 164/260] TSL --- ... the life of your SSD drive with fstrim.md | 107 ++++++++---------- 1 file changed, 49 insertions(+), 58 deletions(-) diff --git a/sources/tech/20200212 Extend the life of your SSD drive with fstrim.md b/sources/tech/20200212 Extend the life of your SSD drive with fstrim.md index 18af55a6d0..24ed876272 100644 --- a/sources/tech/20200212 Extend the life of your SSD drive with fstrim.md +++ b/sources/tech/20200212 Extend the life of your SSD drive with fstrim.md @@ -7,95 +7,90 @@ [#]: via: (https://opensource.com/article/20/2/trim-solid-state-storage-linux) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) -Extend the life of your SSD drive with fstrim +在 Linux 下使用 fstrim 延长 SSD 驱动器的寿命 ====== -A new systemd service to make your life easier. + +> 这个新的系统服务可以使你的生活更轻松。 + ![Linux keys on the keyboard for a desktop computer][1] -Over the past decade, solid-state drives (SSD) have brought about a new way of managing storage. SSDs have benefits like silent and cooler operation and a faster interface spec, compared to their elder spinning ancestors. Of course, new technology brings with it new methods of maintenance and management. SSDs have a feature called TRIM. This is essentially a method for reclaiming unused blocks on the device, which may have been previously written, but no longer contain valid data and therefore, can be returned to the general storage pool for reuse. Opensource.com’s Don Watkins first wrote about TRIM in his 2017 article ["Solid-state drives in Linux: Enabling TRIM for SSDs."][2] +在过去的十年中,固态驱动器(SSD)带来了一种管理存储的新方法。与上一代的转盘产品相比,SSD 具有无声、更冷却的操作和更快的接口规格等优点。当然,新技术带来了新的维护和管理方法。SSD 具有称为 TRIM 的功能。从本质上讲,这是一种用于回收设备上未使用的块的方法,该块可能先前已被写入,但不再包含有效数据,因此可以返回到通用存储池以供重用。Opensource.com 的 Don Watkins 在首先其 2017 年的文章《[Linux 固态驱动器:为 SSD 启用 TRIM][2]》中介绍了 TRIM 的内容。 -If you have been using this feature on your Linux system, then you are probably familiar with the two methods described below. +如果你一直在 Linux 系统上使用此功能,则你可能熟悉下面描述的两种方法。 -### The old ways +### 老的方式 -#### Discard - -I initially enabled this with the discard option to the mount command. The configuration is placed into the **/etc/fstab** file for each file system. +#### 丢弃选项 +我最初使用 `mount` 命令的 `discard` 选项启用了此功能。每个文件系统的配置都放在 `/etc/fstab` 文件中。 ``` # cat /etc/fstab UUID=3453g54-6628-2346-8123435f  /home  xfs  defaults,discard   0 0 ``` -The discard option enables automatic online TRIM. There has recently been debate on whether this is the best method due to possible negative performance impacts. Using this option causes a TRIM to be initiated every time new data is written to the drive. This may introduce additional activity that interferes with storage performance. +丢弃选项可启用自动的在线 TRIM。由于可能会对性能造成负面影响,最近关于这是否是最佳方法一直存在争议。使用此选项会在每次将新数据写入驱动器时启动 TRIM。这可能会引入其他活动,从而影响存储性能。 -#### Cron - -I removed the discard option from the **fstab** file. Then I created a cron job to call the command on a scheduled basis. +#### Cron 作业 +我从 `fstab` 文件中删除了丢弃选项。然后,我创建了一个 cron 作业来按计划调用该命令。 ``` # crontab -l @midnight /usr/bin/trim ``` -This is the method I used most recently on my Ubuntu Linux systems until I learned about another way. +这是我最近在 Ubuntu Linux 系统上使用的方法,直到我了解到另一种方法。 -### A new TRIM service +### 一个新的 TRIM 服务 -I recently discovered that a systemd service for TRIM exists. Fedora [introduced][3] this into their distribution in version 30, and, although it is not enabled by default in versions 30 and 31, it is planned to be in version 32. If you’re working on Fedora Workstation 31 and you want to begin using this feature, you can enable it very easily. I’ll also show you how to test it below. This service is not unique to Fedora. The existence and status will depend on an individual distribution basis. +我最近发现有一个用于 TRIM 的 systemd 服务。Fedora 在版本 30 中将其[引入][3],尽管默认情况下在版本 30 和 31 中未启用它,但计划在版本 32 中使用它。如果你使用的是 Fedora 工作站 31,并且你想要开始使用此功能,可以非常轻松地启用它。我还将在下面向你展示如何对其进行测试。该服务并非 Fedora 独有的服务。它是否存在和地位将因发行版而异。 -#### Test - -I like to test first, to better understand what is happening behind the scenes. I do this by opening a terminal and issuing the command that the service is configured to call. +#### 测试 +我喜欢先进行测试,以更好地了解幕后情况。我通过打开终端并发出配置服务调用的命令来执行此操作。 ``` -`/usr/sbin/fstrim --fstab --verbose --quiet` +/usr/sbin/fstrim --fstab --verbose --quiet ``` -The **–help** argument to **fstrim** will describe these and other arguments. - +`fstrim` 的 `-help` 参数将描述这些信息和其他参数。 ``` $ sudo /usr/sbin/fstrim --help Usage: - fstrim [options] <mount point> + fstrim [options] Discard unused blocks on a mounted filesystem. Options: - -a, --all           trim all supported mounted filesystems - -A, --fstab         trim all supported mounted filesystems from /etc/fstab - -o, --offset <num>  the offset in bytes to start discarding from - -l, --length <num>  the number of bytes to discard - -m, --minimum <num> the minimum extent length to discard - -v, --verbose       print number of discarded bytes -     --quiet         suppress error messages - -n, --dry-run       does everything, but trim + -a, --all trim all supported mounted filesystems + -A, --fstab trim all supported mounted filesystems from /etc/fstab + -o, --offset the offset in bytes to start discarding from + -l, --length the number of bytes to discard + -m, --minimum the minimum extent length to discard + -v, --verbose print number of discarded bytes + --quiet suppress error messages + -n, --dry-run does everything, but trim - -h, --help          display this help - -V, --version       display version + -h, --help display this help + -V, --version display version ``` -So, now I can see that the systemd service is configured to run the trim on all supported mounted filesystems in my **/etc/fstab** file **–fstab** and print the number of discarded bytes **–verbose** but suppress any error messages that might occur **–quiet**. Knowing these options is helpful for testing. For instance, I can start with the safest one, which is the dry run. I’ll also leave off the quiet argument so I can determine if any errors will occur with my drive setup. - +因此,现在我可以看到这个 systemd 服务已配置为在我的 `/etc/fstab` 文件中的所有受支持的挂载文件系统上运行该修剪操作( `-fstab`),并打印出丢弃的字节数(`-verbose`),但是抑制了任何可能会发生的错误消息(`–quiet`)。了解这些选项对测试很有帮助。例如,我可以从最安全的方法开始,即空运行。 我还将去掉 `-quiet` 参数,以便确定驱动器设置是否发生任何错误。 ``` -`$ sudo /usr/sbin/fstrim --fstab --verbose --dry-run` +$ sudo /usr/sbin/fstrim --fstab --verbose --dry-run ``` -This will simply show what the **fstrim** command will do based on the file systems that it finds configured in your **/etc/fstab** file. - +这就会显示 `fstrim` 命令根据在 `/etc/fstab` 文件中找到的文件系统要执行的操作。 ``` -`$ sudo /usr/sbin/fstrim --fstab --verbose` +$ sudo /usr/sbin/fstrim --fstab --verbose ``` -This will now send the TRIM operation to the drive and report on the number of discarded bytes from each file system. Below is an example after my recent fresh install of Fedora on a new NVME SSD. - +现在,这会将 TRIM 操作发送到驱动器,并报告每个文件系统中丢弃的字节数。以下是我最近在新的 NVME SSD 上全新安装 Fedora 之后的示例。 ``` /home: 291.5 GiB (313011310592 bytes) trimmed on /dev/mapper/wkst-home @@ -104,44 +99,40 @@ This will now send the TRIM operation to the drive and report on the number of d /: 60.7 GiB (65154805760 bytes) trimmed on /dev/mapper/wkst-root ``` -#### Enable - -Fedora Linux implements systemd timer service, scheduled to run on a weekly basis. To check the existence and current status, run **systemctl status**. +#### 启用 +Fedora Linux 实现了一个计划每周运行它的 systemd 计时器服务。要检查其是否存在和当前状态,请运行 `systemctl status`。 ``` -`$ sudo systemctl status fstrim.timer` +$ sudo systemctl status fstrim.timer ``` -Now, enable the service. - +现在,启用该服务。 ``` -`$ sudo systemctl enable fstrim.timer` +$ sudo systemctl enable fstrim.timer ``` -#### Verify - -Then you can verify that the timer is enabled by listing all of the timers. +#### 验证 +然后,你可以通过列出所有计时器来验证该计时器是否已启用。 ``` -`$ sudo systemctl list-timers --all` +$ sudo systemctl list-timers --all ``` -The following line referring to the **fstrim.timer** will appear. Notice that the timer actually activates **fstrim.service**. This is from where the actual **fstrim** is called. The time-related fields show **n/a** because the service has just been enabled and has not run yet. - +会显示出下列表明 `fstrim.timer` 存在的行。注意,该计时器实际上激活了 `fstrim.service`。这是 `fstrim` 实际调用的地方。与时间相关的字段显示为 `n/a`,因为该服务已启用且尚未运行。 ``` NEXT   LEFT    LAST   PASSED   UNIT           ACTIVATES n/a    n/a     n/a    n/a      fstrim.timer   fstrim.service ``` -### Conclusion +### 结论 -This service seems like the best way to run TRIM on your drives. It is much simpler than having to create your own crontab entry to call the **fstrim** command. It is also safer not having to edit the **fstab** file. It has been interesting to watch the evolution of solid-state storage technology and nice to know that it appears Linux is moving toward a standard and safe way to implement it. +该服务似乎是在驱动器上运行 TRIM 的最佳方法。这比必须创建自己的 crontab 条目来调用 `fstrim` 命令要简单得多。不必编辑 `fstab` 文件也更安全。观察固态存储技术的发展很有趣,并且我很高兴看到 Linux 似乎正在朝着标准且安全的方向实现它。 -In this article, learn how solid state drives differ from traditional hard drives and what it means... +在本文中,学习了固态驱动器与传统硬盘驱动器有何不同以及它的含义... -------------------------------------------------------------------------------- @@ -149,7 +140,7 @@ via: https://opensource.com/article/20/2/trim-solid-state-storage-linux 作者:[Alan Formy-Duval][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/) 荣誉推出 @@ -157,5 +148,5 @@ via: https://opensource.com/article/20/2/trim-solid-state-storage-linux [a]: https://opensource.com/users/alanfdoss [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer) -[2]: https://opensource.com/article/17/1/solid-state-drives-linux-enabling-trim-ssds +[2]: https://linux.cn/article-8177-1.html [3]: https://fedoraproject.org/wiki/Changes/EnableFSTrimTimer (Fedora Project WIKI: Changes/EnableFSTrimTimer) From 68205fa9cfa70b1a6529c166d36ad02517a4895e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 21:03:28 +0800 Subject: [PATCH 165/260] APL --- .../20200130 4 open source productivity tools on my wishlist.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200130 4 open source productivity tools on my wishlist.md b/sources/tech/20200130 4 open source productivity tools on my wishlist.md index d36f020aa3..1b19980605 100644 --- a/sources/tech/20200130 4 open source productivity tools on my wishlist.md +++ b/sources/tech/20200130 4 open source productivity tools on my wishlist.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a6032e24bb9afc57f482ff07463a4c86db53ead4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 21:47:00 +0800 Subject: [PATCH 166/260] TSL --- ...ource productivity tools on my wishlist.md | 76 ------------------- ...ource productivity tools on my wishlist.md | 76 +++++++++++++++++++ 2 files changed, 76 insertions(+), 76 deletions(-) delete mode 100644 sources/tech/20200130 4 open source productivity tools on my wishlist.md create mode 100644 translated/tech/20200130 4 open source productivity tools on my wishlist.md diff --git a/sources/tech/20200130 4 open source productivity tools on my wishlist.md b/sources/tech/20200130 4 open source productivity tools on my wishlist.md deleted file mode 100644 index 1b19980605..0000000000 --- a/sources/tech/20200130 4 open source productivity tools on my wishlist.md +++ /dev/null @@ -1,76 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 open source productivity tools on my wishlist) -[#]: via: (https://opensource.com/article/20/1/open-source-productivity-tools) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -4 open source productivity tools on my wishlist -====== -Find out what the open source world needs to work on in the final -article in our series on 20 ways to be more productive with open source -in 2020. -![Two diverse hands holding a globe][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### But what about… - -When searching for productivity apps, I never find everything I want, and I almost always miss something great that my readers share with me. So, as I bring this series to a close, it's time [again][2] to talk about some of the topics I failed to cover in this year's series. - -![Desktop with Joplin, Emacs, and Firefox][3] - -#### Chatting in Vim - -I tried. I really, _really_ tried to get chat to work in Vim, but it was not to be. The one package I was able to find, [VimIRC.vim][4], never did work for me, and I tried for a few days to no avail. The other option I explored was [Irc it][5], which requires a lot more [effort to set up][6] than I could fit into my available space or time. I tried, I really did, and for the Vim users out there, I'm sorry I wasn't able to get something workable for you. - -#### Org mode - -![Org Mode in Emacs][7] - -I love [Org Mode][8], and I use it daily. I could spend several days _just_ talking about Org. It provides basic [task tracking][9]; Google [calendar][10] sync and [CalFW][11] integration; rich text documents, websites, and presentations; linking to all the things; and; and; and… - -I expect you will hear more from me about Org in 2020 because it really is pretty cool. - -#### GUI programs - -In 2019's productivity series, I shared a lot of programs with a graphical user interface (GUI), and this year almost all are command-line applications. There are some great graphical programs to help with some of the things I talked about this year—[mail][12] programs to talk to Maildir mailboxes, calendar programs to read local calendar files, [weather][13] apps, and so on. I even tried several new-to-me things to see if they would fit with the overall theme. With the exception of [twin][14], I didn't feel that there were any GUI programs that were new (to me) or notable (again, to me) to write about this year. And that brings me to… - -#### Mobile - -More and more people are using tablets (sometimes in conjunction with a laptop) as their primary device. I use my phone for most of my social media and instant messaging, and, more often than not, I use my tablet (OK, let's be honest, _tablets_) to read or browse the web. It isn't that open source mobile apps aren't out there, that's for sure, but they didn't fit with my themes this year. There is a lot going on with open source and mobile apps, and I'm watching carefully for things that can help me be more productive on my phone and tablet. - -### Your turn - -Thank you very much for reading the series this year. Please comment with what you think I missed or need to look at for 2021. And as I say on the [Productivity Alchemy][15] podcast: "Remember folks: Stay productive!" - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/open-source-productivity-tools - -作者:[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 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_hands_diversity.png?itok=zm4EDxgE (Two diverse hands holding a globe) -[2]: https://opensource.com/article/19/1/productivity-tool-wish-list -[3]: https://opensource.com/sites/default/files/uploads/productivity_20-1.png (Desktop with Joplin, Emacs, and Firefox) -[4]: https://github.com/vim-scripts/VimIRC.vim -[5]: https://tools.suckless.org/ii/ -[6]: https://www.reddit.com/r/vim/comments/48t7ws/vim_ii_irc_client_xpost_runixporn/d0macnl/ -[7]: https://opensource.com/sites/default/files/uploads/productivity_20-2.png (Org Mode in Emacs) -[8]: https://orgmode.org/ -[9]: https://opensource.com/article/20/1/open-source-to-do-list -[10]: https://opensource.com/article/20/1/open-source-calendar -[11]: https://github.com/kiwanami/emacs-calfw -[12]: https://opensource.com/article/20/1/organize-email-notmuch -[13]: https://opensource.com/article/20/1/open-source-weather-forecast -[14]: https://github.com/cosmos72/twin -[15]: https://productivityalchemy.com diff --git a/translated/tech/20200130 4 open source productivity tools on my wishlist.md b/translated/tech/20200130 4 open source productivity tools on my wishlist.md new file mode 100644 index 0000000000..eaebf35f1d --- /dev/null +++ b/translated/tech/20200130 4 open source productivity tools on my wishlist.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 open source productivity tools on my wishlist) +[#]: via: (https://opensource.com/article/20/1/open-source-productivity-tools) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +我的愿望清单上的 4 个开源生产力工具 +====== + +> 在 2020 年用开源实现更高生产力的二十种方式的最后一篇文章中,了解开源世界需要做什么。 + +![Two diverse hands holding a globe][1] + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 不过… + +在搜索生产力应用程序时,我找不到想要的一切应用,而且几乎总是会丢失一些读者与我分享的精彩内容。 因此,当我结束本系列文章时,是时候[再次][2]谈论我在本年度系列文章中未能涵盖的一些主题。 + +![Desktop with Joplin, Emacs, and Firefox][3] + +#### 在 Vim 中聊天 + +我试过了。我真的非常非常想能够在 Vim 中聊天,但我做不到。我找到的一个软件包 [VimIRC.vim][4] 一直就工作不起来,我试了几天也没用。我探索的另一个选项是 [Irc it][5],这需要我付出更多的[努力去设置][6],超过了我正常可以付出的耐心或时间。我尝试过了,也确实做到了,但对于同处于相同境地的 Vim 用户,对不起,我无法帮到你。 + +#### Org 模式 + +![Org Mode in Emacs][7] + +我喜欢 [Org 模式][8],并且每天都使用它。关于 Org 模式我可以滔滔不绝的说上几天。它提供了基本的[任务跟踪][9];谷歌[日历][10]同步和 [CalFW][11] 集成;富文本文档、网站和演示文稿;链接到任何事物;等等、等等…… + +我希望你会在 2020 年从我这里收到更多有关 Org 模式的信息,因为它真的很酷。 + +#### 图形用户界面程序 + +在 2019 年的生产力系列中,我共享了很多图形用户界面程序,而今年几乎都是命令行应用程序。有一些很棒的图形程序可以帮助解决我今年谈论的一些问题,例如可以使用 Maildir 邮箱的[邮件][12]程序、用于读取本地日历文件的日历程序、[天气][13]应用程序等等。我甚至尝试了几项对我而言新奇的事物,看它们是否适合这个主题。除了 [twin][14] 之外,我没有感觉到有什么图形用户界面程序是新颖的(对我而言)或值得注意的(同样对我而言)今年要写的。至于…… + +#### 移动应用程序 + +越来越多的人将平板电脑(有时与笔记本电脑结合使用)作为主要设备。我将手机用于大多数社交媒体和即时消息传递,并且经常使用平板电脑(好的,老实说,好几个平板电脑)来阅读或浏览网络。可以肯定的是,并不是开源移动应用程序不存在,但是它们与我今年的主题不符。开源和移动应用程序正在发生很多变化,我正在仔细地寻找可以帮助我在手机和平板电脑上提高工作效率的事物。 + +### 该你了 + +非常感谢你阅读今年的系列文章。请你发表评论,告诉我错过的或需要在 2021 年看到的内容。正如我在 [Productivity Alchemy] [15] 播客上所说:“哥们,记着:保持生产力!” + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-productivity-tools + +作者:[Kevin 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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_hands_diversity.png?itok=zm4EDxgE (Two diverse hands holding a globe) +[2]: https://opensource.com/article/19/1/productivity-tool-wish-list +[3]: https://opensource.com/sites/default/files/uploads/productivity_20-1.png (Desktop with Joplin, Emacs, and Firefox) +[4]: https://github.com/vim-scripts/VimIRC.vim +[5]: https://tools.suckless.org/ii/ +[6]: https://www.reddit.com/r/vim/comments/48t7ws/vim_ii_irc_client_xpost_runixporn/d0macnl/ +[7]: https://opensource.com/sites/default/files/uploads/productivity_20-2.png (Org Mode in Emacs) +[8]: https://orgmode.org/ +[9]: https://opensource.com/article/20/1/open-source-to-do-list +[10]: https://opensource.com/article/20/1/open-source-calendar +[11]: https://github.com/kiwanami/emacs-calfw +[12]: https://opensource.com/article/20/1/organize-email-notmuch +[13]: https://opensource.com/article/20/1/open-source-weather-forecast +[14]: https://github.com/cosmos72/twin +[15]: https://productivityalchemy.com From e410bb05f7ce7a1be8a7994b8baa48019ed5edd9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 22:04:23 +0800 Subject: [PATCH 167/260] TSL --- .../20200212 Extend the life of your SSD drive with fstrim.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20200212 Extend the life of your SSD drive with fstrim.md (100%) diff --git a/sources/tech/20200212 Extend the life of your SSD drive with fstrim.md b/translated/tech/20200212 Extend the life of your SSD drive with fstrim.md similarity index 100% rename from sources/tech/20200212 Extend the life of your SSD drive with fstrim.md rename to translated/tech/20200212 Extend the life of your SSD drive with fstrim.md From 964218debcd387146e69fc5c57f1442cd0fb2999 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 22:28:26 +0800 Subject: [PATCH 168/260] =?UTF-8?q?=E8=B6=85=E6=9C=9F=E5=9B=9E=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Morisun029 @lixin555 @nacyro @lnrCoder @summer2233 @BrunoJu @lxbwolf --- ...ear in review, and more industry trends.md | 71 ---------- ... years of Java, and other industry news.md | 71 ---------- ...wered by Ceph, and more industry trends.md | 66 ---------- ...a Major Update With Version 2.5 Release.md | 115 ----------------- ...sma 5.18 LTS Released With New Features.md | 121 ------------------ ...GNU-Linux is Turning into Hyperbola BSD.md | 2 +- ...r your System Drive using Software RAID.md | 2 +- ...your awk skills with two easy tutorials.md | 2 +- ...1 A guide to intermediate awk scripting.md | 2 +- ...8 How to use regular expressions in awk.md | 2 +- ...and tutorials for beginners and experts.md | 2 +- ...ll No Longer Have The Default Root User.md | 87 ------------- ...113 How to setup a DNS server with bind.md | 2 +- 13 files changed, 7 insertions(+), 538 deletions(-) delete mode 100644 sources/news/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md delete mode 100644 sources/news/20200205 The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news.md delete mode 100644 sources/news/20200211 Building a Linux desktop, CERN powered by Ceph, and more industry trends.md delete mode 100644 sources/news/20200212 OpenShot Video Editor Gets a Major Update With Version 2.5 Release.md delete mode 100644 sources/news/20200213 KDE Plasma 5.18 LTS Released With New Features.md delete mode 100644 sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md diff --git a/sources/news/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md b/sources/news/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md deleted file mode 100644 index 7a3a40d845..0000000000 --- a/sources/news/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (NSA cloud advice, Facebook open source year in review, and more industry trends) -[#]: via: (https://opensource.com/article/20/1/nsa-facebook-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -NSA cloud advice, Facebook open source year in review, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Facebook open source year in review][2] - -> Last year was a busy one for our [open source][3] engineers. In 2019 we released 170 new open source projects, bringing our portfolio to a total of 579 [active repositories][3]. While it’s important for our internal engineers to contribute to these projects (and they certainly do — with more than 82,000 commits this year), we are also incredibly grateful for the massive support from external contributors. Approximately 2,500 external contributors committed more than 32,000 changes. In addition to these contributions, nearly 93,000 new people starred our projects this year, growing the most important component of any open source project — the community! Facebook Open Source would not be here without your contributions, so we want to thank you for your participation in 2019. - -**The impact**: Facebook got ~33% more changes than they would have had they decided to develop these as closed projects. Organizations addressing similar challenges got an 82,000-commit boost in exchange. What a clear illustration of the business impact of open source development. - -## [Cloud advice from the NSA][4] - -> This document divides cloud vulnerabilities into four classes (misconfiguration, poor access control, shared tenancy vulnerabilities, and supply chain vulnerabilities) that encompass the vast majority of known vulnerabilities. Cloud customers have a critical role in mitigating misconfiguration and poor access control, but can also take actions to protect cloud resources from the exploitation of shared tenancy and supply chain vulnerabilities. Descriptions of each vulnerability class along with the most effective mitigations are provided to help organizations lock down their cloud resources. By taking a risk-based approach to cloud adoption, organizations can securely benefit from the cloud’s extensive capabilities. - -**The impact**: The Fear, Uncertainty, and Doubt (FUD) that has been associated with cloud adoption is being debunked more all the time. None other then the US Department of Defense has done a lot of the thinking so you don't have to, and there is a good chance that their concerns are at least as dire as yours are. - -## [With Kubernetes, China Minsheng Bank transformed its legacy applications][5] - -> But all of CMBC’s legacy applications—for example, the core banking system, payment systems, and channel systems—were written in C and Java, using traditional architecture. “We wanted to do distributed applications because in the past we used VMs in our own data center, and that was quite expensive and with low resource utilization rate,” says Zhang. “Our biggest challenge is how to make our traditional legacy applications adaptable to the cloud native environment.” So far, around 20 applications are running in production on the Kubernetes platform, and 30 new applications are in active development to adopt the Kubernetes platform. - -**The impact**: This illustrates nicely the challenges and opportunities facing businesses in a competitive environment, and suggests a common adoption pattern. Do new stuff the new way, and move the old stuff as it makes sense. - -## [The '5 Rs' of the move to cloud native: Re-platform, re-host, re-factor, replace, retire][6] - -> The bottom line is that telcos and service providers will go cloud native when it is cheaper for them to migrate to the cloud and pay cloud costs than it is to remain in the data centre. That time is now and by adhering to the "5 Rs" of the move to cloud native, Re-platform, Re-host, Re-factor, Replace and/or Retire, the path is open, clearly marked and the goal eminently achievable. - -**The impact**: Cloud-native is basically used as a synonym for open source in this interview; there is no other type of technology that will deliver the same lift. - -## [Fedora CoreOS out of preview][7] - -> Fedora CoreOS is a new Fedora Edition built specifically for running containerized workloads securely and at scale. It’s the successor to both [Fedora Atomic Host][8] and [CoreOS Container Linux][9] and is part of our effort to explore new ways of assembling and updating an OS. Fedora CoreOS combines the provisioning tools and automatic update model of Container Linux with the packaging technology, OCI support, and SELinux security of Atomic Host.  For more on the Fedora CoreOS philosophy, goals, and design, see the [announcement of the preview release][10]. - -**The impact**: Collapsing these two branches of the Linux family tree into one another moves the state of the art forward for everyone (once you get through the migration). - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/nsa-facebook-more-industry-trends - -作者:[Tim Hildred][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/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://opensource.com/article/20/1/hybrid-developer-future-industry-trends -[3]: https://opensource.facebook.com/ -[4]: https://media.defense.gov/2020/Jan/22/2002237484/-1/-1/0/CSI-MITIGATING-CLOUD-VULNERABILITIES_20200121.PDF -[5]: https://www.cncf.io/blog/2020/01/23/with-kubernetes-china-minsheng-bank-transformed-its-legacy-applications-and-moved-into-ai-blockchain-and-big-data/ -[6]: https://www.telecomtv.com/content/cloud-native/the-5-rs-of-the-move-to-cloud-native-re-platform-re-host-re-factor-replace-retire-37473/ -[7]: https://fedoramagazine.org/fedora-coreos-out-of-preview/ -[8]: https://www.projectatomic.io/ -[9]: https://coreos.com/os/docs/latest/ -[10]: https://fedoramagazine.org/introducing-fedora-coreos/ diff --git a/sources/news/20200205 The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news.md b/sources/news/20200205 The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news.md deleted file mode 100644 index 2e814fdfc0..0000000000 --- a/sources/news/20200205 The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news) -[#]: via: (https://opensource.com/article/20/2/linux-java-and-other-industry-news) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Need 32-bit Linux to run past 2038? When version 5.6 of the kernel pops, you're in for a treat][2] - -> Arnd Bergmann, an engineer working on the thorny Y2038 problem in the Linux kernel, posted to the [mailing list][3] that, yup, Linux 5.6 "should be the first release that can serve as a base for a 32-bit system designed to run beyond year 2038." - -**The impact:** Y2K didn't get fixed; it just got bigger and delayed. There is no magic in software or computers; just people trying to solve complicated problems as best they can, and some times introducing more complicated problems for different people to solve at some point in the future. - -## [What the dev? Celebrating Java's 25th anniversary][4] - -> Java is coming up on a big milestone: Its 25th anniversary! To celebrate, we take a look back over the last 25 years to see how Java has evolved over time. In this episode, Social Media and Online Editor Jenna Sargent talks to Rich Sharples, senior director of product management for middleware at Red Hat, to learn more. - -**The impact:** There is something comforting about immersing yourself in a deep well of lived experience. Rich clearly lived through what he is talking about and shares insider knowlege with you (and his dog). - -## [Do I need an API Gateway if I use a service mesh?][5] - -> This post may not be able to break through the noise around API Gateways and Service Mesh. However, it’s 2020 and there is still abundant confusion around these topics. I have chosen to write this to help bring real concrete explanation to help clarify differences, overlap, and when to use which. Feel free to [@ me on twitter (@christianposta)][6] if you feel I’m adding to the confusion, disagree, or wish to buy me a beer (and these are not mutually exclusive reasons). - -**The impact:** Yes, though they use similar terms and concepts they have different concerns and scopes. - -## [What Australia's AGL Energy learned about Cloud Native compliance][7] - -> This is really at the heart of what open source is, enabling everybody to contribute equally. Within large enterprises, there are controls that are needed, but if we can automate the management of the majority of these controls, we can enable an amazing culture and development experience. - -**The impact:** They say "software is eating the world" and "developers are the new kingmakers." The fact that compliance in an energy utility is subject to developer experience improvement basically proves both statements. - -## [Monoliths are the future][8] - -> And then what they end up doing is creating 50 deployables, but it’s really a _distributed_ monolith. So it’s actually the same thing, but instead of function calls and class instantiation, they’re initiating things and throwing it over a network and hoping that it comes back. And since they can’t reliably _make it_ come back, they introduce things like [Prometheus][9], [OpenTracing][10], all of this stuff. I’m like, **“What are you doing?!”** - -**The impact:** Do things for real reasons with a clear-eyed understanding of what those reasons are and how they'll make your business or your organization better. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/linux-java-and-other-industry-news - -作者:[Tim Hildred][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/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.theregister.co.uk/2020/01/30/linux_5_6_2038/ -[3]: https://lkml.org/lkml/2020/1/29/355 -[4]: https://whatthedev.buzzsprout.com/673192/2543290-celebrating-java-s-25th-anniversary-episode-16 -[5]: https://blog.christianposta.com/microservices/do-i-need-an-api-gateway-if-i-have-a-service-mesh/ (Do I Need an API Gateway if I Use a Service Mesh?) -[6]: http://twitter.com/christianposta?lang=en -[7]: https://thenewstack.io/what-australias-agl-energy-learned-about-cloud-native-compliance/ -[8]: https://changelog.com/posts/monoliths-are-the-future -[9]: https://prometheus.io/ -[10]: https://opentracing.io diff --git a/sources/news/20200211 Building a Linux desktop, CERN powered by Ceph, and more industry trends.md b/sources/news/20200211 Building a Linux desktop, CERN powered by Ceph, and more industry trends.md deleted file mode 100644 index 424f69bcc2..0000000000 --- a/sources/news/20200211 Building a Linux desktop, CERN powered by Ceph, and more industry trends.md +++ /dev/null @@ -1,66 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Building a Linux desktop, CERN powered by Ceph, and more industry trends) -[#]: via: (https://opensource.com/article/20/2/linux-desktop-cern-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -Building a Linux desktop, CERN powered by Ceph, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Building a Linux desktop for cloud-native development][2] - -> This post covers the building of my Linux Desktop PC for Cloud Native Development. I'll be covering everything from parts, to peripherals, to CLIs, to SaaS software with as many links and snippets as I can manage. I hope that you enjoy reading about my experience, learn something, and possibly go on to build your own Linux Desktop. - -**The impact**: I hope the irony is not lost on anyone that step 1, when doing cloud-native software development, is to install Linux on a physical computer. - -## [Enabling CERN’s particle physics research with open source][3] - -> Ceph is an open-source software-defined storage platform. While it’s not often in the spotlight, it’s working hard behind the scenes, playing a crucial role in enabling ambitious, world-renowned projects such as CERN’s particle physics research, Immunity Bio’s cancer research, The Human Brain Project, MeerKat radio telescope, and more. These ventures are propelling the collective understanding of our planet and the human race beyond imaginable realms, and the outcomes will forever change how we perceive our existence and potential.  - -**The impact**: It is not often that you get to see a straight line drawn between storage and the perception of human existence. Thanks for that, CERN! - -## [2020 cloud predictions][4] - -> "Serverless" as a concept provides a simplified developer experience that will become a platform feature. More platform-as-a-service providers will incorporate serverless traits into the daily activities developers perform when building cloud-native applications, becoming the default computing paradigm for the cloud. - -**The impact:** All of the trends in the predictions in this post are basically about maturation as ideas like serverless, edge computing, DevOps, and other cloud-adjacent buzz words move from the early adopters into the early majority phase of the adoption curve. - -## [End-of-life announcement for CoreOS Container Linux][5] - -> As we've [previously announced][6], [Fedora CoreOS][7] is the official successor to CoreOS Container Linux. Fedora CoreOS is a [new Fedora Edition][8] built specifically for running containerized workloads securely and at scale. It combines the provisioning tools and automatic update model of Container Linux with the packaging technology, OCI support, and SELinux security of Atomic Host. For more on the Fedora CoreOS philosophy, goals, and design, see the [announcement of the preview release][9] and the [Fedora CoreOS documentation][10]. - -**The impact**: Milestones like this are often bittersweet for both creators and users. The CoreOS team built something that their community loved to use, which is something to be celebrated. Hopefully, that community can find a [new home][11] in the wider [Fedora ecosystem][8]. - -_I hope you enjoyed this list and come back next week for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/linux-desktop-cern-more-industry-trends - -作者:[Tim Hildred][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/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://blog.alexellis.io/building-a-linux-desktop-for-cloud-native-development/ -[3]: https://insidehpc.com/2020/02/how-ceph-powers-exciting-research-with-open-source/ -[4]: https://www.devopsdigest.com/2020-cloud-predictions-2 -[5]: https://coreos.com/os/eol/ -[6]: https://groups.google.com/d/msg/coreos-user/zgqkG88DS3U/PFP9yrKbAgAJ -[7]: https://getfedora.org/coreos/ -[8]: https://fedoramagazine.org/fedora-coreos-out-of-preview/ -[9]: https://fedoramagazine.org/introducing-fedora-coreos/ -[10]: https://docs.fedoraproject.org/en-US/fedora-coreos/ -[11]: https://getfedora.org/en/coreos/ diff --git a/sources/news/20200212 OpenShot Video Editor Gets a Major Update With Version 2.5 Release.md b/sources/news/20200212 OpenShot Video Editor Gets a Major Update With Version 2.5 Release.md deleted file mode 100644 index bb3b2dc59a..0000000000 --- a/sources/news/20200212 OpenShot Video Editor Gets a Major Update With Version 2.5 Release.md +++ /dev/null @@ -1,115 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (OpenShot Video Editor Gets a Major Update With Version 2.5 Release) -[#]: via: (https://itsfoss.com/openshot-2-5-release/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -OpenShot Video Editor Gets a Major Update With Version 2.5 Release -====== - -[OpenShot][1] is one of the [best open-source video editors][2] out there. With all the features that it offered – it was already a good video editor on Linux. - -Now, with a major update to it (**v.2.5.0**), OpenShot has added a lot of new improvements and features. And, trust me, it’s not just any regular release – it is a huge release packed with features that you probably wanted for a very long time. - -In this article, I will briefly mention the key changes involved in the latest release. - -![][3] - -### OpenShot 2.5.0 Key Features - -Here are some of the major new features and improvements in OpenShot 2.5: - -#### Hardware Acceleration Support - -The hardware acceleration support is still an experimental addition – however, it is a useful feature to have. - -Instead of relying on your CPU to do all the hard work, you can utilize your GPU to encode/decode video data when working with MP4/H.264 video files. - -This will affect (or improve) the performance of OpenShot in a meaningful way. - -#### Support Importing/Exporting Files From Final Cut Pro & Premiere - -![][4] - -[Final Cut Pro][5] and [Adobe Premiere][6] are the two popular video editors for professional content creators. OpenShot 2.5 now allows you to work on projects created on these platforms. It can import (or export) the files from Final Cut Pro & Premiere in EDL & XML formats. - -#### Thumbnail Generation Improved - -This isn’t a big feature – but a necessary improvement to most of the video editors. You don’t want broken images in the thumbnails (your timeline/library). So, with this update, OpenShot now generates the thumbnails using a local HTTP server, can check multiple folder locations, and regenerate missing ones. - -#### Blender 2.8+ Support - -The new OpenShot release also supports the latest [Blender][7] (.blend) format – so it should come in handy if you’re using Blender as well. - -#### Easily Recover Previous Saves & Improved Auto-backup - -![][8] - -It was always a horror to lose your timeline work after you accidentally deleted it – which was then auto-saved to overwrite your saved project. - -Now, the auto-backup feature has improved with an added ability to easily recover your previous saved version of the project. - -Even though you can recover your previous saves now – you will find a limited number of the saved versions, so you have to still remain careful. - -#### Other Improvements - -In addition to all the key highlights mentioned above, you will also notice a performance improvement when using the keyframe system. - -Several other issues like SVG compatibility, exporting & modifying keyframe data, and resizable preview window have been fixed in this major update. For privacy-concerned users, OpenShot no longer sends usage data unless you opt-in to share it with them. - -For more information, you can take a look at [OpenShot’s official blog post][9] to get the release notes. - -### Installing OpenShot 2.5 on Linux - -You can simply download the .AppImage file from its [official download page][10] to [install the latest OpenShot version][11]. If you’re new to AppImage, you should also check out [how to use AppImage][12] on Linux to easily launch OpenShot. - -[Download Latest OpenShot Release][10] - -Some distributions like Arch Linux may also provide the latest OpenShot release with regular system updates. - -#### PPA available for Ubuntu-based distributions - -On Ubuntu-based distributions, if you don’t want to use AppImage, you can [use the official PPA][13] from OpenShot: - -``` -sudo add-apt-repository ppa:openshot.developers/ppa -sudo apt update -sudo apt install openshot-qt -``` - -You may want to know how to remove PPA if you want to uninstall it later. - -**Wrapping Up** - -With all the latest changes/improvements considered, do you see [OpenShot][11] as your primary [video editor on Linux][14]? If not, what more do you expect to see in OpenShot? Feel free to share your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/openshot-2-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://www.openshot.org/ -[2]: https://itsfoss.com/open-source-video-editors/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/openshot-2-5-0.png?ssl=1 -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/openshot-xml-edl.png?ssl=1 -[5]: https://www.apple.com/in/final-cut-pro/ -[6]: https://www.adobe.com/in/products/premiere.html -[7]: https://www.blender.org/ -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/openshot-recovery.jpg?ssl=1 -[9]: https://www.openshot.org/blog/2020/02/08/openshot-250-released-video-editing-hardware-acceleration/ -[10]: https://www.openshot.org/download/ -[11]: https://itsfoss.com/openshot-video-editor-release/ -[12]: https://itsfoss.com/use-appimage-linux/ -[13]: https://itsfoss.com/ppa-guide/ -[14]: https://itsfoss.com/best-video-editing-software-linux/ diff --git a/sources/news/20200213 KDE Plasma 5.18 LTS Released With New Features.md b/sources/news/20200213 KDE Plasma 5.18 LTS Released With New Features.md deleted file mode 100644 index 8100290280..0000000000 --- a/sources/news/20200213 KDE Plasma 5.18 LTS Released With New Features.md +++ /dev/null @@ -1,121 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (KDE Plasma 5.18 LTS Released With New Features) -[#]: via: (https://itsfoss.com/kde-plasma-5-18-release/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -KDE Plasma 5.18 LTS Released With New Features -====== - -[KDE plasma][1] desktop is undoubtedly one of the most impressive [Linux desktop environments][2] available out there right now. - -Now, with the latest release, the KDE Plasma desktop just got more awesome! - -KDE Plasma 5.18 marks itself as an LTS (Long Term Support) release i.e it will be maintained by the KDE contributors for the next 2 years while the regular versions are maintained for just 4 months. - -![KDE Plasma 5.18 on KDE Neon][3] - -So, if you want more stability on your KDE-powered Linux system, it would be a good idea to upgrade to KDE’s Plasma 5.18 LTS release. - -### KDE Plasma 5.18 LTS Features - -Here are the main new features added in this release: - -#### Emoji Selector - -![Emoji Selector in KDE][4] - -Normally, you would Google an emoji to copy it to your clipboard or simply use the good-old emoticons to express yourself. - -Now, with the latest update, you get an emoji selector in Plasma Desktop. You can simply find it by searching for it in the application launcher or by just pressing (Windows key/Meta/Super Key) + . (**period/dot)**. - -The shortcut should come in handy when you need to use an emoji while sending an email or any other sort of messages. - -#### Global Edit Mode - -![Global Edit Mode][5] - -You probably would have used the old desktop toolbox on the top-right corner of the screen in the Plasma desktop, but the new release gets rid of that and instead – provides you with a global edit mode when you right-click on the desktop and click on “**Customize Layout**“. - -#### Night Color Control - -![Night Color Control][6] - -Now, you can easily toggle the night color mode right from the system tray. In addition to that, you can even choose to set a keyboard shortcut for both night color and the do not disturb mode. - -#### Privacy Improvements For User Feedback - -![Improved Privacy][7] - -It is worth noting that KDE Plasma lets you control the user feedback information that you share with them. - -You can either choose to disable sharing any information at all or control the level of information you share (basic, intermediate, and detailed). - -#### Global Themes - -![Themes][8] - -You can either choose from the default global themes available or download community-crafted themes to set up on your system. - -#### UI Improvements - -There are several subtle improvements and changes. For instance, the look and feel of the notifications have improved. - -You can also notice a couple of differences in the software center (Discover) to help you easily install apps. - -Not just limited to that, but you also get the ability to mute the volume of a window from the taskbar (just like you normally do on your browser’s tab). Similarly, there are a couple of changes here and there to improve the KDE Plasma experience. - -#### Other Changes - -In addition to the visual changes and customization ability, the performance of KDE Plasma has improved when coupled with a graphics hardware. - -To know more about the changes, you can refer the [official announcement post][9] for KDE Plasma 5.18 LTS. - -[Subscribe to our YouTube channel for more Linux videos][10] - -### How To Get KDE Plasma 5.18 LTS? - -If you are using a rolling release distribution like Arch Linux, you might have got it with the system updates. If you haven’t performed an update yet, simply check for updates from the system settings. - -If you are using Kubuntu, you can add the Kubuntu backports PPA to update the Plasma desktop with the following commands: - -``` -sudo add-apt-repository ppa:kubuntu-ppa/backports -sudo apt update && sudo apt full-upgrade -``` - -If you do not have KDE as your desktop environment, you can refer our article on [how to install KDE on Ubuntu][11] to get started. - -**Wrapping Up** - -KDE Plasma 5.18 may not involve a whole lot of changes – but being an LTS release, the key new features seem helpful and should come in handy to improve the Plasma desktop experience for everyone. - -What do you think about the latest Plasma desktop release? Feel free to let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/kde-plasma-5-18-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://kde.org/plasma-desktop/ -[2]: https://itsfoss.com/best-linux-desktop-environments/ -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/kde-plasma-5-18-info.jpg?ssl=1 -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/kde-plasma-emoji-pick.jpg?ssl=1 -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/kde-plasma-global-editor.jpg?ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/kde-plasma-night-color.jpg?ssl=1 -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/user-feedback-kde-plasma.png?ssl=1 -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/kde-plasma-global-themes.jpg?ssl=1 -[9]: https://kde.org/announcements/plasma-5.18.0.php -[10]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[11]: https://itsfoss.com/install-kde-on-ubuntu/ diff --git a/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md index a2bca0089f..68ede9acfa 100644 --- a/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md +++ b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (Morisun029) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190503 Mirror your System Drive using Software RAID.md b/sources/tech/20190503 Mirror your System Drive using Software RAID.md index e72f3a5722..ba62a2f21a 100644 --- a/sources/tech/20190503 Mirror your System Drive using Software RAID.md +++ b/sources/tech/20190503 Mirror your System Drive using Software RAID.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (lixin555) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md index 76f7a54e5f..f84e4ebe3a 100644 --- a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md +++ b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (nacyro) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191111 A guide to intermediate awk scripting.md b/sources/tech/20191111 A guide to intermediate awk scripting.md index 7e788b2adc..53e7126eb1 100644 --- a/sources/tech/20191111 A guide to intermediate awk scripting.md +++ b/sources/tech/20191111 A guide to intermediate awk scripting.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (lnrCoder) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191118 How to use regular expressions in awk.md b/sources/tech/20191118 How to use regular expressions in awk.md index a0be0df4d7..2cf5881263 100644 --- a/sources/tech/20191118 How to use regular expressions in awk.md +++ b/sources/tech/20191118 How to use regular expressions in awk.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (lixin555) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md b/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md index 03fc77a8e1..3172f26ea1 100644 --- a/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md +++ b/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (summer2233) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md b/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md deleted file mode 100644 index 0f087529b9..0000000000 --- a/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (BrunoJu) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Kali Linux Will No Longer Have The Default Root User) -[#]: via: (https://itsfoss.com/kali-linux-root-user/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Kali Linux Will No Longer Have The Default Root User -====== - -Kali Linux is a specialized Linux distribution for cyber security testing and hacking related tasks. - -If you’ve used [Kali Linux][1], you probably know that it followed a default root user policy. In other words, you are always root in Kali Linux. Whatever you do – you will be accessing tools/applications as root by default. - -It looks like everything back then was kind of “root for all” for everything. So, the default root user policy existed. - -They also explained the history for this in their [announcement post][2]: - -> A lot of those tools back then either required root access to run or ran better when ran as root. With this operating system that would be ran from a CD, never be updated, and had a lot of tools that needed root access to run it was a simple decision to have a “everything as root” security model. It made complete sense for the time. - -### Kali Linux will now have a default non-root user (like most other distributions) - -![][3] - -A default non-root model was necessary because a lot of users now use Kali Linux as their daily driver. - -Of course, they [do not recommend using Kali Linux][4] as a replacement for stable distributions like Ubuntu/Fedora/Manjaro – however, with its active development, some users do consider using it on a day-to-day basis instead of just using it for its tools. - -So, with a wide mainstream usage of the distro, the Kali Linux team thought of switching to a default non-root model because nowadays a lot of applications/tools do not require root access. - -> While we don’t encourage people to run Kali as their day to day operating system, over the last few years more and more users have started to do so _(even if they are not using it to do penetration testing full time)_, including some members of the Kali development team. When people do so, they obviously don’t run as default root user. With this usage over time, there is the obvious conclusion that default root user is no longer necessary and Kali will be better off moving to a more traditional security model. - -So I am reiterating that you should not consider Kali Linux to be fit for your daily tasks if you do not utilize security-related [Kali Linux tools][5]. Feel free to experiment – but I wouldn’t be so sure to rely on it. - -So from the next release, when you install Kali Linux, you’ll be asked to create non-root user that will have admin privileges. Tools and commands that require root access will be run with sudo. - -![][6] - -#### [Pretend to be Using Windows with Kali Linux Undercover Mode][7] - -The new undercover mode in Kali Linux switches the desktop layout to make it look like Windows 10. Find out how to activate the undercover mode. - -### New default user and password for Kali Linux live mode - -![Kali Linux has new user-password in the live system][8] - -Technically, you won’t find a groundbreaking difference. Just note that the default user ID and password in live mode is “**kali**“. - -You can find the new non-root model implemented in the new daily/weekly builds if you want to test it early. - -In either case, you can wait for the 2020.1 release scheduled for late January to take a look at the new default non-root user model. - -### Getting back the old root model in Kali Linux - -If you are a long time Kali Linux user, you may not find it convenient to add sudo before commands and then manually enter the password. - -The good news here is that you can still get the old password-less root rights with this command: - -``` -sudo dpkg-reconfigure kali-grant-root -``` - -What do you think about the default non-root user model? Is it a good decision? Let me know your thoughts in the comments. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/kali-linux-root-user/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.kali.org/ -[2]: https://www.kali.org/news/kali-default-non-root-user/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/kali_linux_default_root_user.png?ssl=1 -[4]: https://itsfoss.com/kali-linux-review/ -[5]: https://itsfoss.com/best-kali-linux-tools/ -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/kali_linux_undercover_mode.jpg?fit=800%2C450&ssl=1 -[7]: https://itsfoss.com/kali-linux-undercover-mode/ -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/kali-linux-live-password.png?ssl=1 diff --git a/sources/tech/20200113 How to setup a DNS server with bind.md b/sources/tech/20200113 How to setup a DNS server with bind.md index 74cc32e747..897dc825a8 100644 --- a/sources/tech/20200113 How to setup a DNS server with bind.md +++ b/sources/tech/20200113 How to setup a DNS server with bind.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (lxbwolf) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8850cbbdc4f4fdc054733314702fd3e369847a4e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 22:40:49 +0800 Subject: [PATCH 169/260] =?UTF-8?q?=E8=B6=85=E6=9C=9F=E5=9B=9E=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @MonkeyDEcho --- sources/tech/20180416 Cgo and Python.md | 1 - ...181105 5 Minimal Web Browsers for Linux.md | 171 ------------------ 2 files changed, 172 deletions(-) delete mode 100644 sources/tech/20181105 5 Minimal Web Browsers for Linux.md diff --git a/sources/tech/20180416 Cgo and Python.md b/sources/tech/20180416 Cgo and Python.md index c78a820276..e5688d43c8 100644 --- a/sources/tech/20180416 Cgo and Python.md +++ b/sources/tech/20180416 Cgo and Python.md @@ -1,5 +1,4 @@ Cgo and Python -[#] MonkeyDEcho translating ============================================================ ![](https://datadog-prod.imgix.net/img/blog/engineering/cgo-and-python/cgo_python_hero.png?auto=format&w=1900&dpr=1) diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md deleted file mode 100644 index 34c0c1e18e..0000000000 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ /dev/null @@ -1,171 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MonkeyDEcho ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (5 Minimal Web Browsers for Linux) -[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -[#]: url: ( ) - -5 Minimal Web Browsers for Linux -====== -linux上的五种微型浏览器 -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) - -There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. -有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 - -The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. -web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 - -There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. -但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 - -Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. -让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! - -### GNOME Web - -GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. -GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 - -Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: - - * Simplicity - Feature bloat and user interface clutter are considered evil. - - * Standards compliance - No non-standard features will ever be introduced to the codebase. - - * Software freedom - Epiphany will always be released under a license that respects freedom. - - * Human interface - Epiphany follows the [GNOME Human Interface Guidelines][6]. - - * Minimal preferences - Preferences are only added when they make sense and after careful consideration. - - * Target audience - Non-technical users are the primary target audience (which helps to define the types of features that are included). - - - - -GNOME Web is as clean and simple a web browser as you’ll find (Figure 1). - -![GNOME Web][8] - -Figure 1: The GNOME Web browser displaying a minimal amount of preferences for the user. - -[Used with permission][9] - -The GNOME Web manifesto reads: - -A web browser is more than an application: it is a way of thinking, a way of seeing the world. Epiphany's principles are simplicity, standards compliance, and software freedom. - -### Netsurf - -The [Netsurf][10] minimal web browser opens almost faster than you can release the mouse button. Netsurf uses its own layout and rendering engine (designed completely from scratch), which is rather hit and miss in its rendering (Figure 2). - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) - -Although you might find Netsurf to suffer from rendering issues on certain sites, understand the Hubbub HTML parser is following the work-in-progress HTML5 specification, so there will be issues popup now and then. To ease those rendering headaches, Netsurf does include HTTPS support, web page thumbnailing, URL completion, scale view, bookmarks, full-screen mode, keyboard shorts, and no particular GUI toolkit requirements. That last bit is important, especially when you switch from one desktop to another. - -For those curious as to the requirements for Netsurf, the browser can run on a machine as slow as a 30Mhz ARM 6 computer with 16MB of RAM. That’s impressive, by today’s standard. - -### QupZilla - -If you’re looking for a minimal browser that uses the Qt Framework and the QtWebKit rendering engine, [QupZilla][11] might be exactly what you’re looking for. QupZilla does include all the standard features and functions you’d expect from a web browser, such as bookmarks, history, sidebar, tabs, RSS feeds, ad blocking, flash blocking, and CA Certificates management. Even with those features, QupZilla still manages to remain a very fast lightweight web browser. Other features include: Fast startup, speed dial homepage, built-in screenshot tool, browser themes, and more. -One feature that should appeal to average users is that QupZilla has a more standard preferences tools than found in many lightweight browsers (Figure 3). So, if going too far outside the lines isn’t your style, but you still want something lighter weight, QupZilla is the browser for you. - -![QupZilla][13] - -Figure 3: The QupZilla preferences tool. - -[Used with permission][9] - -### Otter Browser - -Otter Browser is a free, open source attempt to recreate the closed-source offerings found in the Opera Browser. Otter Browser uses the WebKit rendering engine and has an interface that should be immediately familiar with any user. Although lightweight, Otter Browser does include full-blown features such as: - - * Passwords manager - - * Add-on manager - - * Content blocking - - * Spell checking - - * Customizable GUI - - * URL completion - - * Speed dial (Figure 4) - - * Bookmarks and various related features - - * Mouse gestures - - * User style sheets - - * Built-in Note tool - - -![Otter][15] - -Figure 4: The Otter Browser Speed Dial tab. - -[Used with permission][9] - -Otter Browser can be run on nearly any Linux distribution from an [AppImage][16], so there’s no installation required. Just download the AppImage file, give the file executable permissions (with the command chmod u+x otter-browser-*.AppImage), and then launch the app with the command ./otter-browser*.AppImage. - -Otter Browser does an outstanding job of rendering websites and could function as your go-to minimal browser with ease. - -### Lynx - -Let’s get really minimal. When I first started using Linux, back in ‘97, one of the web browsers I often turned to was a text-only take on the app called [Lynx][17]. It should come as no surprise that Lynx is still around and available for installation from the standard repositories. As you might expect, Lynx works from the terminal window and doesn’t display pretty pictures or render much in the way of advanced features (Figure 5). In fact, Lynx is as bare-bones a browser as you will find available. Because of how bare-bones this web browser is, it’s not recommended for everyone. But if you happen to have a gui-less web server and you have a need to be able to read the occasional website, Lynx can be a real lifesaver. - -![Lynx][19] - -Figure 5: The Lynx browser rendering the Linux.com page. - -[Used with permission][9] - -I have also found Lynx an invaluable tool when troubleshooting certain aspects of a website (or if some feature on a website is preventing me from viewing the content in a regular browser). Another good reason to use Lynx is when you only want to view the content (and not the extraneous elements). - -### Plenty More Where This Came From - -There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not. - -Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux - -作者:[Jack Wallen][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/jlwallen -[b]: https://github.com/lujun9972 -[1]: https://www.mozilla.org/en-US/firefox/new/ -[2]: https://www.chromium.org/ -[3]: https://vivaldi.com/ -[4]: https://www.google.com/chrome/ -[5]: https://www.merriam-webster.com/dictionary/epiphany -[6]: https://developer.gnome.org/hig/stable/ -[7]: /files/images/minimalbrowsers1jpg -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) -[9]: /licenses/category/used-permission -[10]: https://www.netsurf-browser.org/ -[11]: https://qupzilla.com/ -[12]: /files/images/minimalbrowsers3jpg -[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) -[14]: /files/images/minimalbrowsers4jpg -[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) -[16]: https://sourceforge.net/projects/otter-browser/files/ -[17]: https://lynx.browser.org/ -[18]: /files/images/minimalbrowsers5jpg -[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) -[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From cd96fd2215eb1dcb5e92974e060d9f9c62c117b1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Mar 2020 22:45:05 +0800 Subject: [PATCH 170/260] TSL --- .../tech/20181231 Troubleshooting hardware problems in Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20181231 Troubleshooting hardware problems in Linux.md (100%) diff --git a/sources/tech/20181231 Troubleshooting hardware problems in Linux.md b/translated/tech/20181231 Troubleshooting hardware problems in Linux.md similarity index 100% rename from sources/tech/20181231 Troubleshooting hardware problems in Linux.md rename to translated/tech/20181231 Troubleshooting hardware problems in Linux.md From 90a3e3db8f716d7d398d4ba3181cf04429d1ce1b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Mar 2020 00:54:20 +0800 Subject: [PATCH 171/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200303=20Sessio?= =?UTF-8?q?n:=20An=20Open=20Source=20Private=20Messenger=20That=20Doesn?= =?UTF-8?q?=E2=80=99t=20Need=20Your=20Phone=20Number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md --- ...ger That Doesn-t Need Your Phone Number.md | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md diff --git a/sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md b/sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md new file mode 100644 index 0000000000..bc4dece67e --- /dev/null +++ b/sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Session: An Open Source Private Messenger That Doesn’t Need Your Phone Number) +[#]: via: (https://itsfoss.com/session-messenger/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Session: An Open Source Private Messenger That Doesn’t Need Your Phone Number +====== + +_**Brief: Our open source software highlight of the week is Session. It is a fork of another increasingly popular private messenger Signal. Session doesn’t even need your phone number to operate.**_ + +### Session: A private messenger in true sense + +![][1] + +Privacy concerned people are always in the search of an ultimate service that lets you communicate securely while respecting our privacy across multiple platforms. + +Recently, I came across an interesting open-source messaging app “[Session][2]” by [Loki Foundation][3], which is technically a fork of another [open source encrypted messenger Signal][4]. + +In this article, I’ll be sharing my experience with the Session app while highlighting the features it offers. + +Session is fairly new to the scene – I’ve mentioned some of the bugs that I encountered at the bottom of the article. + +### Features of Session Messenger + +I’ll highlight the key features of Session that will help you decide if it’s good enough for you to try. + +#### Session does not require a phone number + +![][5] + +For privacy-enthusiasts, registering the phone number with Signal or other such applications is a potential risk. + +But, with Session, you do not need a phone number, simply click on “**Create Account**” after you install it on your desktop or phone and it will simply generate a random (unique) **Session ID**. + +It’ll look something like this: **05652245af9a8bfee4f5a8138fd5c……..** + +So, you just have to share your Session ID with the contact you want to add. Or, you can also opt to get the **QR Code** after account creation which you can share with your friends to add you back. + +#### Session uses blockchain (and other crypto tech) + +![Session ID][6] + +For the users who’re aware of what a [blockchain][7] is – they’ve been waiting for real-world applications that an average user can utilize. Session is one such example that utilizes blockchain at its core and you don’t need to know it’s there. + +If you’re curious about how it works, you can take a look at their [official blog post][8] explaining it. + +#### Cross-Platform Support + +![][9] + +For something strictly privacy-focused, you’d also want it to be available across multiple platforms. + +Of course, primarily, I’d focus on the Linux and Android support but it also supports Windows/Mac/iOS. So, you can easily sync between multiple devices cross-platform. + +#### Includes Essential Privacy Options + +![][10] + +Undoubtedly, it offers some essential privacy-focused features that will help make the experience more secure. + +For starters, you have the following options: + + * **Message TTL**: This lets you control how long the message exists before the recipient sees the message. + * **Read Receipts**: Let others know that you’ve seen the message or if your message has been read. + + + +#### Session uses a decentralized network and protects your metadata + +Even though Session isn’t a peer-to-peer technology, it does not have a central server for the network. + +It takes a decentralized approach to how the messages are transmitted (or routed). If you’ve no idea what I’m talking about, you can follow Session’s official blog post to know the [difference between centralization and decentralization][11] and explore how it potentially works. + +And, this approach of network helps them to protect the metadata (the information associated with a message like IP address). + +#### Other Features + +Not just limited to the latest/greatest privacy-friendly features, but it also supports group chats, voice messages, and also allows you to send attachments. + +### Installing Session on Linux + +If you head to the [official download page][12], you will be able to download an .**AppImage** file. In case you have no clue how it works, you should take a look at our article on [how to use AppImage][13]. + +In either case, you can also head to their [GitHub releases page][14] and grab the **.deb** file. + +[Download Session][12] + +### My Experience On Using Session App + +I’ve managed to try it on multiple platforms. For the desktop, I utilized the .AppImage file on **Pop!_OS 19.10** to run Session. + +Overall, the user experience was impressive and had no UI glitches. + +It’s also easy to recover your account once you’ve backed up your secret code (which is known as **seed**) from the settings. + +![][15] + +But, I also noticed a couple of issues- which can be fixed/improved: + + * Delay in accepting a friend request + * The way of linking devices is not intuitive + * Sometimes when you reply from two separate devices (using the same ID), the receiver gets two different conversations. + + + +**Conclusion** + +Of course, nothing’s ever perfect. For now, I’m thinking of keeping it installed and considering Session’s features, it is definitely something a privacy-focused user should try. + +What do you think about it? Feel free to let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/session-messenger/ + +作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-app.jpg?ssl=1 +[2]: https://getsession.org/ +[3]: https://loki.foundation/ +[4]: https://itsfoss.com/signal-messaging-app/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-create.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/session-application-id.jpg?ssl=1 +[7]: https://en.wikipedia.org/wiki/Blockchain +[8]: https://getsession.org/how-session-protects-your-anonymity-with-blockchain-and-crypto/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-cross-platform.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-settings.jpg?fit=800%2C512&ssl=1 +[11]: https://getsession.org/centralisation-vs-decentralisation-in-private-messaging/ +[12]: https://getsession.org/download/ +[13]: https://itsfoss.com/use-appimage-linux/ +[14]: https://github.com/loki-project/session-desktop/releases +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-seed.jpg?ssl=1 From 64c310139c390e7d12d9075d3ee858edbe1cd3fb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Mar 2020 00:55:35 +0800 Subject: [PATCH 172/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200302=20Instal?= =?UTF-8?q?l=20GNU=20Emacs=20on=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200302 Install GNU Emacs on Windows.md --- .../20200302 Install GNU Emacs on Windows.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/tech/20200302 Install GNU Emacs on Windows.md diff --git a/sources/tech/20200302 Install GNU Emacs on Windows.md b/sources/tech/20200302 Install GNU Emacs on Windows.md new file mode 100644 index 0000000000..be429efe50 --- /dev/null +++ b/sources/tech/20200302 Install GNU Emacs on Windows.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Install GNU Emacs on Windows) +[#]: via: (https://opensource.com/article/20/3/emacs-windows) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Install GNU Emacs on Windows +====== +Even if your operating system is closed source, you can still use this +popular open source text editor. +![Tall building with windows][1] + +GNU Emacs is a popular text editor designed for programmers of all sorts. Because it was developed on Unix and is widely used on Linux (and shipped with macOS), people sometimes don't realize that it's also available for Microsoft Windows. You don't need to be an experienced or full-time programmer to make use of Emacs, either. You can download and install Emacs with just a few clicks, and this article shows you how. + +You can install Windows manually or with a package manager, like [Chocolatey][2]. + +### 7-zip + +If you haven't already installed 7-zip for Windows, you should do that first. [7-zip][3] is an open source archive utility with the ability to create and extract ZIP, 7z, TAR, XZ, BZIP2, and GZIP (and more) files. It's an invaluable tool for Windows users. + +After installing 7-zip, you have new 7-zip archive options in your right-click menu when browsing files in Windows Explorer. + +### Powershell and Chocolatey + +To install GNU Emacs on Windows using Chocolatey: + + +``` +`PS> choco install emacs-full` +``` + +Once it has installed, launch Emacs from Powershell: + + +``` +`PS> emacs` +``` + +![Emacs running on Windows][4] + +### Download GNU Emacs for Windows + +To manually install GNU Emacs on Windows, you must [download Emacs][5]. + +![GNU Windows downloader][6] + +This takes you to a server near you, which shows you a list of all available Emacs releases. Find the directory with the highest release number and click into it. There are many different builds of Emacs for Windows, but the most general-purpose version is just named **emacs-VERSION-ARCHITECTURE.zip**. The **VERSION** depends upon which release you're downloading, while the **ARCHITECTURE** depends on whether you have a 32-bit or 64-bit machine. Most modern computers are 64-bit, but if you're in doubt you can download the 32-bit version, which runs on both. + +If you're downloading version 26 of Emacs for a 64-bit machine, you would click the link titled **emacs-26.2-x86_64.zip**. There are smaller downloads available (such as the **no-deps** variety) but you must be familiar with how Emacs is built from source code, knowing which libraries it needs and which of those your computer has on it already. Generally, it's easiest to get the large version of Emacs, because it contains everything it needs to run on your computer. + +### Extract Emacs + +Next, unarchive the ZIP file you downloaded. To extract it, right-click on the Emacs ZIP file and select **Extract to Emacs-VERSION** from the 7-zip sub-menu. It's a big archive, so it may take a while to uncompress, but when it does, you have a new directory containing all the files distributed with Emacs. For example, in this example, the file **emacs-26.2-x86_64.zip** was downloaded, so the unarchived directory is **emacs-26.2-x86_64**. + +### Launch Emacs + +Within the Emacs directory, find the **bin** directory. This folder stores all the binary executable files (EXE files) distributed with Emacs. Double-click the **emacs.exe** file to launch the application. + +![Emacs running on Windows][7] + +You can create a shortcut to **emacs.exe** on your desktop for easier access. + +### Learn Emacs + +Emacs isn't as obtuse as its reputation may indicate. It's got its own traditions and conventions, but when you're typing text into it, you can treat it exactly as you treat Notepad or any given text field on any given website. + +The important differences occur when you _edit_ the text you've typed. + +The only way to learn is to start using it, though, so make Emacs your go-to text editor for simple tasks. When you'd normally open Notepad or Word or Evernote or whatever it is you use for quick notes or as a temporary scratchpad, launch Emacs instead. + +Emacs has the reputation of being a terminal-based application, but obviously it has a GUI, so use the GUI often, just as you would with any application. Copy, cut, and paste (or "yank" in Emacs terminology) from the menu instead of with the keyboard, and open and save files from the menu or toolbar. Start from the beginning and learn the application based on what it is and not how you think it should act based on your experience with other editors. + +### Download our [cheatsheet][8]! + +_Thanks to Matthias Pfuetzner and Stephen Smoogen._ + +These are Jimmy's six favorite open source applications that he immediately installs on a new... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/emacs-windows + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/windows_building_sky_scale.jpg?itok=mH6CAX29 (Tall building with windows) +[2]: https://github.com/chocolatey/choco +[3]: https://www.7-zip.org/ +[4]: https://opensource.com/sites/default/files/uploads/windows-ps-choco-emacs.jpg (Emacs running on Windows) +[5]: https://www.gnu.org/software/emacs/download.html +[6]: https://opensource.com/sites/default/files/uploads/windows-emacs-download.jpg (GNU Windows downloader) +[7]: https://opensource.com/sites/default/files/uploads/windows-emacs.jpg (Emacs running on Windows) +[8]: https://opensource.com/downloads/emacs-cheat-sheet From ec7255480e6bcac1bde1267401c05181bca9767c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Mar 2020 00:57:27 +0800 Subject: [PATCH 173/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200302=20Using?= =?UTF-8?q?=20LibreOffice=20for=20your=20open=20source=20budgeting=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200302 Using LibreOffice for your open source budgeting tool.md --- ...ice for your open source budgeting tool.md | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 sources/tech/20200302 Using LibreOffice for your open source budgeting tool.md diff --git a/sources/tech/20200302 Using LibreOffice for your open source budgeting tool.md b/sources/tech/20200302 Using LibreOffice for your open source budgeting tool.md new file mode 100644 index 0000000000..9d26ff39c7 --- /dev/null +++ b/sources/tech/20200302 Using LibreOffice for your open source budgeting tool.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using LibreOffice for your open source budgeting tool) +[#]: via: (https://opensource.com/article/20/3/libreoffice-open-source-budget) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +Using LibreOffice for your open source budgeting tool +====== +Figure out where your money is going with this LibreOffice Calc budget +template. +![scientific calculator][1] + +Budgets can be intimidating for beginners. It can feel overwhelming to think about money, much less about how to keep track of it. But it's important to know where your money is coming and going. + +In this article, I'll step through a sample budget by explaining the logic behind important money decisions as well as the formulas you need to automate the process. Fortunately, LibreOffice makes it easy for anyone to keep their yearly budget in check, even the math-averse. + +### Getting started + +Begin by downloading and installing [LibreOffice][2], if you don't already have it. Next, download my [LibreOffice Calc template][3], which you can use as a starting point to create your own budget to meet your spending and savings goals. + +It's important to interact with your spreadsheet frequently. You can input transactions as they happen, daily, or weekly. You even could save up your receipts to calculate all your expenses at the end of the month, but this can be a hard slog. You want budgeting to be as quick and easy as possible. + +### Categories + +The first step to creating a budget is to decide on the categories you want to track. These categories can be as simple or as complex as you like. Think about what is useful to your personal situation and financial goals. You can easily add or change categories as your needs change. + +The template has a number of example categories you can start with. There is no right or wrong way to choose categories; your budget has to work for you. Look through the list in Column A of the **Budget** tab and decide which ones to keep, which to delete, and any others you want to add. Then edit that list to align with your personal income and expense situation. + +#### Create category drop-down menus + +![Budget categories][4] + +The template uses a drop-down menu to make it easy to assign categories to income and expenses. You can view them on the **Monthly** sheets (accessed with the tabs at the bottom of the LibreOffice window). Click on a cell in Column C, and a drop-down arrow will appear on the right. Click the arrow, and you'll see the example categories. You may need to change some of them so that they will match the categories in your budget (Column A of the **Budget** tab). + +To add or remove categories from the dropdown menu, click on Column C in a Monthly sheet to select all **Category** cells. Then, in the main menu, select **Data** > **Validity**. This opens up a dialog box. + +In **Validity**, select the **Criteria** tab, then click on the arrow to the right of **Allow**, set it to **List**, and type the categories you want to use in the **Entries** box. Type one category per line. Make sure to use the exact same categories you used on the **Budget** sheet in Column A. + +### Estimating your budget + +Once you have defined your categories, it's time to estimate how much you expect to earn and spend. You can calculate these amounts monthly, yearly, or using a mix of the two. + +Your first year of budgeting estimates won't be perfect, and you may be surprised at how much or little you spend on certain categories. But doing this will help you get a realistic idea of where your money is going. You can make adjustments in your second year to create a more accurate budget based upon what you spend in year one. + +In Column B (**Monthly Estimate**) of the **Budget** tab, enter your anticipated _monthly_ income and expenses for each category (an exception is the **Charity** row, which is automatically calculated as a percentage of your income). For _annual_ expenses and income (e.g., taxes, insurance, tuition, etc.), enter them in Column P (**Yearly Estimate**). + +#### Calculating the annual cost of monthly expenses + +Most expenses occur monthly. To find the yearly cost of a monthly expense, multiply your monthly estimate by 12. You could do this manually for each category, but it is much easier to use formulas. + +Formulas are automated calculations that determine the value of a cell. Formulas do all the heavy lifting, so you don't have to do a lot of sums in your head. + +In the template, you can use the **Yearly Estimate** column to make an equation to annualize a monthly expense or income. In a cell in Column P, type this: + + +``` +`=SUM(x*12)` +``` + +but change _x_ to the name of the **Monthly Estimate** cell you want to use. (For example, to calculate the annual cost of your phone service using the template, the formula would read **=SUM(B12*13)**.) + +#### Calculating the monthly cost of yearly expenses + +You may pay some expenses, such as car insurance, only once a year. You can either ignore these expenses in the monthly estimates or put money aside for them in your budget each month. + +If you want to do the latter, you need to divide your **Yearly Estimate** by 12 and put that amount into your monthly budget. To do so, place this equation in the appropriate cell in the **Monthly Estimate** column: + + +``` +`=SUM(x/12)` +``` + +where _x_ is the corresponding **Yearly Estimate** cell on your spreadsheet (from Column P). + +#### Finding percentages + +If you want to donate or save a percentage of your income, there's a function for that, too! + +The common recommendation is to put aside 20% of your take-home pay for savings. While I don't focus on this too much, I do find it helpful to see if I'm meeting my savings goals from month to month. + +For instance, Row 32 of the **Budget** tab template uses this formula to calculate the 20% of your income that you should allocate to savings: + + +``` +`=SUM(B2*0.2)` +``` + +This same method can be used if you give a percentage (e.g., 10%) of your income to charity (Row 21 of the template): + + +``` +`=SUM(B2*-0.1)` +``` + +This formula uses a negative percentage because donating to charity is an expense. + +### Entering monthly income and expenses + +The template pulls data totals from the **Monthly** sheets (the tabs at the bottom of the spreadsheet) to populate Columns C through N on the **Budget** sheet. + +It's useful to place each month's transactions on separate sheets of your budget spreadsheet. By keeping your receipts from purchases and entering them into each month's sheet, you create a digital record of your money. + +Enter income as positive numbers and expenses as negative numbers. Select the appropriate category using the drop-down in the **Category** column. + +In LibreOffice, the **SUMIF** function can look at values in a specific column and extract only the ones that occur next to a specific word. My template uses a **SUMIF** formula to extract values based on the adjacent category in order to enter an amount in the correct cell on the **Budget** tab. For example, to enter January's internet expenses into the **Budget** spreadsheet, enter this formula in cell C12: + + +``` +`=SUMIF(january.$C:$C,A12,january.$D:$D)` +``` + +This looks at January's Column C and, if it sees an entry that contains the word in A12 on the **Budget** tab (Internet), then it extracts the number from Column D on the **January** tab and enters that value into the cell that contains the formula on the **Budget** tab (C12). + +### Analyzing your budget data + +#### Adding a range of numbers to calculate YTD spending + +To see how much you have spent overall this year to date (YTD), select the cell where you want to display that data (in the template, it's cell O29, under the **YTD** column), and enter the following formula to total the range of numbers corresponding to your monthly **Total Expense**: + + +``` +`=SUM(x:y)` +``` + +Instead of _x_ and _y_, enter the first cell and the last cell in the range. You can type them in manually, but it's easier and less error-prone to just click and drag from the first to last cell. LibreOffice does the calculation and enters the appropriate values. + +#### Seeing how you're doing on your budget + +A big part of budgeting is comparing your estimates to your actual income and expenses. In the template, this is the **Budget** tab's Column Q. This column subtracts the contents of each cell in Column O (**YTD**) from Column P (**Yearly Estimate**).  + + +``` +`=SUM(x-y)` +``` + +where _x_ and _y_ equal the corresponding cells from Column P and O. For example, using the template to calculate how much you've spent on Utilities compared to your budget, you would enter **=SUM(P11-O11)**. + +![Budget overview][5] + +### Tracking expenses + +Now that your yearly budget is set up, you are ready to start meeting your financial goals. + +It's important to look at your budget often—and it's equally important to do so without guilt. Think of this process as gathering data so that you can adjust your estimates for the next year. The primary goal of budgeting is to understand your own spending habits and refine either your expectations or your behavior so that you can plan better for how your income is used. + +Which open source tools and apps do you use to budget? Tell us in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/libreoffice-open-source-budget + +作者:[Jess Weichler][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/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c (scientific calculator) +[2]: https://www.libreoffice.org/download/download/ +[3]: https://opensource.com/sites/default/files/uploads/budget_template_0.ods +[4]: https://opensource.com/sites/default/files/uploads/imagebudget_cat.png (Budget categories) +[5]: https://opensource.com/sites/default/files/uploads/imagebudget_overview.png (Budget overview) From a5c982d71d5d9547357c898676750677ea3865cb Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Mar 2020 00:59:21 +0800 Subject: [PATCH 174/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200302=208=20re?= =?UTF-8?q?asons=20to=20consider=20hyperconverged=20infrastructure=20for?= =?UTF-8?q?=20your=20data=20center?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200302 8 reasons to consider hyperconverged infrastructure for your data center.md --- ...ged infrastructure for your data center.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/talk/20200302 8 reasons to consider hyperconverged infrastructure for your data center.md diff --git a/sources/talk/20200302 8 reasons to consider hyperconverged infrastructure for your data center.md b/sources/talk/20200302 8 reasons to consider hyperconverged infrastructure for your data center.md new file mode 100644 index 0000000000..10b1e0575d --- /dev/null +++ b/sources/talk/20200302 8 reasons to consider hyperconverged infrastructure for your data center.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 reasons to consider hyperconverged infrastructure for your data center) +[#]: via: (https://www.networkworld.com/article/3530072/eight-reasons-to-consider-hyperconverged-infrastructure-for-your-data-center.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +8 reasons to consider hyperconverged infrastructure for your data center +====== + +Thinkstock + +Demand for on-premises data center equipment is shrinking as organizations move workloads to the cloud. But on-prem is far from dead, and one segment that’s thriving is hyperconverged infrastructure ([HCI][1]). + +HCI is a form of scale-out, software-integrated infrastructure that applies a modular approach to compute, network and storage capacity. Rather than silos with specialized hardware, HCI leverages distributed, horizontal blocks of commodity hardware and delivers a single-pane dashboard for reporting and management. Form factors vary: Enterprises can choose to deploy hardware-agnostic [hyperconvergence software][2] from vendors such as Nutanix and VMware, or an integrated HCI appliance from vendors such as HP Enterprise, Dell, Cisco, and Lenovo. + +**Learn more about enterprise infrastructure trends** + + * [Making the right hyperconvergence choice: HCI hardware or software?][3] + * [10 of the world's fastest supercomputers][4] + * [NVMe over Fabrics creates data-center storage disruption][5] + * [For enterprise storage, persistent memory is here to stay][6] + + + +The market is growing fast. By 2023, Gartner projects 70% of enterprises will be running some form of hyperconverged infrastructure, up from less than 30% in 2019. And as HCI grows in popularity, cloud providers such as Amazon, Google and Microsoft are providing connections to on-prem HCI products for hybrid deployment and management. + +So why is it so popular? Here are some of the top reasons. + +### 1) Simplified design + +A traditional data center design is comprised of separate storage silos with individual tiers of servers and specialized networking spanning the compute and storage silos. This worked in the pre-cloud era, but it’s too rigid for the cloud era. “It’s untenable for IT teams to take weeks or months to provision new infrastructure so the dev team can produce new apps and get to market quickly,” says Greg Smith, vice president of product marketing at Nutanix. + +“HCI radically simplifies data center architectures and operations, reducing the time and expense of managing data and delivering apps,” he says. + +### 2) Cloud integration + +HCI software, such as from Nutanix or VMware, is deployed the same way in both a customer’s data center and cloud instances; it runs on bare metal instances in the cloud exactly the same as it does in a data center. HCI “is the best foundation for companies that want to build a hybrid cloud. They can deploy apps in their data center and meld it with a public cloud,” Smith says. + +[][7] + +“Because it’s the same on both ends, I can have one team manage an end-to-end hybrid cloud and with confidence that whatever apps run in my private cloud will also run in that public cloud environment,” he adds. + +### 3) Ability to start small, grow large + +“HCI allows you to consolidate compute, network, and storage into one box, and grow this solution quickly and easily without a lot of downtime,” says Tom Lockhart, IT systems manager with Hastings Prince Edward Public Health in Bellville, Ontario, Canada. + +In a legacy approach, multiple pieces of hardware – a server, Fiber Channel switch, host-based adapters, and a hypervisor – have to be installed and configured separately. With hyperconvergence, everything is software-defined. HCI uses the storage in the server, and the software almost entirely auto-configures and detects the hardware, setting up the connections between compute, storage, and networking. + +“Once we get in on a workload, [customers] typically have a pretty good experience. A few months later, they try another workload, then another, and they start to extend it out of their data center to remote sites,” says Chad Dunn, vice president of product management for HCI at Dell. + +“They can start small and grow incrementally larger but also have a consistent operating model experience, whether they have 1,000 nodes or three nodes per site across 1,000 sites, whether they have 40 terabytes of data or 40 petabytes. They have consistent software updates where they don’t have to retrain their people because it’s the same toolset,” Dunn added. + +### 4) Reduced footprint + +By starting small, customers find they can reduce their hardware stack to just what they need, rather than overprovision excessive capacity. Moving away from the siloed approach also allows users to eliminate certain hardware. + +Josh Goodall, automation engineer with steel fabricator USS-POSCO Industries, says his firm deployed HCI primarily for its ability to do stretched clusters, where the hardware cluster is in two physical locations but linked together. This is primarily for use as a backup, so if one site went down, the other can take over the workload. In the process, though, USS-POSCO got rid of a lot of expensive hardware and software. “We eliminated several CPU [software] licenses, we eliminated the SAN from other site, we didn’t need SRM [site recovery management] software, and we didn’t need Commvault licensing. We saved between $25,000 and $30,000 on annual license renewals,” Goodall says. + +### 5) No special skills needed + +To run a traditional three-tiered environment, companies need specialists in compute, storage, and networking. With HCI, a company can manage its environment with general technology consultants and staff rather than the more expensive specialists. + +“HCI has empowered the storage generalist,” Smith says. “You don’t have to hire a storage expert, a network expert. Everyone has to have infrastructure, but they made the actual maintenance of infrastructure a lot easier than under a typical scenario, where a deep level of expertise is needed to manage under those three skill sets.” + +Lockhart of Hastings Prince Edward Public Health says adding new compute/storage/networking is also much faster when compared to traditional infrastructure. “An upgrade to our server cluster was 20 minutes with no down time, versus hours of downtime with an interruption in service using the traditional method,” he says. + +“Instead of concentrating on infrastructure, you can expand the amount of time and resources you spend on workloads, which adds value to your business. When you don’t have to worry about infrastructure, you can spend more time on things that add value to your clients,” Lockhart adds. + +### 6) Faster disaster recovery + +Key elements of hyperconvergence products are their backup, recovery, data protection, and data deduplication capabilities, plus analytics to examine it all. Disaster recovery components are managed from a single dashboard, and HCI monitors not only the on-premises storage but also cloud storage resources. With deduplication, compression rates as high as 55:1, and backups can be done in minutes. + +USS-POSCO Industries is an HP Enterprise shop and uses HPE’s SimpliVity HCI software, which includes dedupe, backup, and recovery. Goodall says he gets about 12-15:1 compression on mixed workloads, and that has eliminated the need for third-party backup software. + +More importantly, recovery timeframes have dropped. “The best recent example is a Windows update messed up a manufacturing line, and the error wasn’t realized for a few weeks. In about 30 minutes, I rolled through four weeks of backups, updated the system, rebooted and tested a 350GB system. Restoring just one backup would have been a multi-hour process,” Goodall says. + +### 7) Hyperconvergence analytics + +HCI products come with a considerable amount of analytics software to monitor workloads and find resource constraints. The monitoring software is consolidated into a single dashboard view of system performance, including negatively impacted performance. + +Hastings recently had a problem with a Windows 7 migration, but the HCI model made it easy to get performance info. “It showed that workloads, depending on time of day, were running out of memory, and there was excessive CPU queuing and paging,” Lockhart says. “We had the entire [issue] written up in an hour. It was easy to determine where problems lie. It can take a lot longer without that single-pane-of-glass view.” + +### 8) Less time managing network, storage resources + +Goodall says he used to spend up to 50% of his time dealing with storage issues and backup matrixes. Now he spends maybe 20% of his time dealing with it and most of his time tackling and addressing legacy systems. And his apps are better performing under HCI. “We’ve had no issues with our SQL databases; if anything, we’ve seen huge performance gain due to the move to full SSDs [instead of hard disks] and the data dedupe, reducing reads and writes in the environment.” + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3530072/eight-reasons-to-consider-hyperconverged-infrastructure-for-your-data-center.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207567/what-is-hyperconvergence.html?nsdr=true +[2]: https://www.networkworld.com/article/3318683/making-the-right-hyperconvergence-choice-hci-hardware-or-software.html +[3]: https://www.networkworld.com/article/3318683/making-the-right-hyperconvergence-choice-hci-hardware-or-software +[4]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html#slide1 +[5]: https://www.networkworld.com/article/3394296/nvme-over-fabrics-creates-data-center-storage-disruption.html +[6]: https://www.networkworld.com/article/3398988/for-enterprise-storage-persistent-memory-is-here-to-stay.html +[7]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From fbfbece223dc77a960fc97da5741cffd189c4b26 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 3 Mar 2020 08:22:50 +0800 Subject: [PATCH 175/260] translated --- ... PHP Development on Fedora with Eclipse.md | 89 ------------------- ... PHP Development on Fedora with Eclipse.md | 89 +++++++++++++++++++ 2 files changed, 89 insertions(+), 89 deletions(-) delete mode 100644 sources/tech/20200214 PHP Development on Fedora with Eclipse.md create mode 100644 translated/tech/20200214 PHP Development on Fedora with Eclipse.md diff --git a/sources/tech/20200214 PHP Development on Fedora with Eclipse.md b/sources/tech/20200214 PHP Development on Fedora with Eclipse.md deleted file mode 100644 index 24ecdcb232..0000000000 --- a/sources/tech/20200214 PHP Development on Fedora with Eclipse.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (PHP Development on Fedora with Eclipse) -[#]: via: (https://fedoramagazine.org/php-development-on-fedora-with-eclipse/) -[#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) - -PHP Development on Fedora with Eclipse -====== - -![][1] - -[Eclipse][2] is a full-featured free and open source IDE developed by the Eclipse Foundation. It has been around since 2001. You can write anything from C/C++ and Java to PHP, Python, HTML, JavaScript, Kotlin, and more in this IDE. - -### Installation - -The software is available from Fedora’s official repository. To install it, invoke: - -``` -sudo dnf install eclipse -``` - -This will install the base IDE and Eclipse platform, which enables you to develop Java applications. In order to add PHP development support to the IDE, run this command: - -``` -sudo dnf install eclipse-pdt -``` - -This will install PHP development tools like PHP project wizard, PHP server configurations, composer support, etc. - -### Features - -This IDE has many features that make PHP development easier. For example, it has a comprehensive project wizard (where you can configure many options for your new projects). It also has built-in features like composer support, debugging support, a browser,a terminal, and more. - -### Sample project - -Now that the IDE is installed, let’s create a simple PHP project. Go to _File →New → Project_. From the resulting dialog, select _PHP project_. Enter a name for your project. There are some other options you might want to change, like changing the project’s default location, enabling JavaScript, and changing PHP version. See the following screenshot. - -![Create A New PHP Project in Eclipse][3] - -You can click the _Finish_ button to create the project or press _Next_ to configure other options like adding include and build paths. You don’t need to change those in most cases. - -Once the project is created, right click on the project folder and select _New → PHP File_ to add a new PHP file to the project. For this tutorial I named it _index.php_, the conventionally-recognized default file in every PHP project. - -![][4] - -Then add the your code to the new file. - -![Demo PHP code][5] - -In the example above, I used CSS, JavaScript, and PHP tags on the same page mainly to show that the IDE is capable of supporting all of them together. - -Once your page is ready, you can see the result output by moving the file to your web server document root or by creating a development PHP server in the project directory. - -Thanks to the built-in terminal in Eclipse, we can launch a PHP development server right from within the IDE. Simply click the terminal icon on the toolbar (![Terminal Icon][6]) and click _OK_. In the new terminal, change to the project directory and run the following command: - -``` -php -S localhost:8080 -t . index.php -``` - -![Terminal output][7] - -Now, open a browser and head over to . If everything has been done correctly per instructions and your code is error-free, you will see the output of your PHP script in the browser. - -![PHP output in Fedora][8] - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/php-development-on-fedora-with-eclipse/ - -作者:[Mehdi Haghgoo][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/powergame/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/php-eclipse-816x346.png -[2]: https://projects.eclipse.org/projects/eclipse -[3]: https://fedoramagazine.org/wp-content/uploads/2020/02/Screenshot-from-2020-02-07-01-58-39.png -[4]: https://fedoramagazine.org/wp-content/uploads/2020/02/Screenshot-from-2020-02-07-02-02-05-1024x576.png -[5]: https://fedoramagazine.org/wp-content/uploads/2020/02/code-1024x916.png -[6]: https://fedoramagazine.org/wp-content/uploads/2020/02/Screenshot-from-2020-02-07-03-50-05.png -[7]: https://fedoramagazine.org/wp-content/uploads/2020/02/terminal-1024x239.png -[8]: https://fedoramagazine.org/wp-content/uploads/2020/02/output.png diff --git a/translated/tech/20200214 PHP Development on Fedora with Eclipse.md b/translated/tech/20200214 PHP Development on Fedora with Eclipse.md new file mode 100644 index 0000000000..a9e0e48a56 --- /dev/null +++ b/translated/tech/20200214 PHP Development on Fedora with Eclipse.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (PHP Development on Fedora with Eclipse) +[#]: via: (https://fedoramagazine.org/php-development-on-fedora-with-eclipse/) +[#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) + +使用 Eclipse 在 Fedora 上进行 PHP 开发 +====== + +![][1] + +[Eclipse][2] 是由 Eclipse 基金会开发的功能全面的免费开源 IDE。自 2001 年以来一直存在。你可以在此 IDE 中编写从 C/C++ 和 Java 到 PHP、Python、HTML、JavaScript、Kotlin 等。 + +### 安装 + +该软件可从 Fedora 的官方仓库中获得。要安装它,请用: + +``` +sudo dnf install eclipse +``` + +这将安装基本的 IDE 和 Eclipse 平台,能让你开发 Java 应用。为了将 PHP 开发支持添加到 IDE,请运行以下命令: + +``` +sudo dnf install eclipse-pdt +``` + +这将安装 PHP 开发工具,如 PHP 项目向导、PHP 服务器配置,composer 支持等。 + +### 功能 + +该 IDE 有许多使 PHP 开发更加容易的功能。例如,它有全面的项目向导(你可以在其中为新项目配置许多选项)。它还有如 composer 支持、调试支持、浏览器、终端等内置功能。 + +### 示例项目 + +现在已经安装了 IDE,让我们创建一个简单的 PHP 项目。进入 _File →New → Project_。在出现的对话框中,选择 _PHP project_。输入项目的名称。你可能还需要更改其他一些选项,例如更改项目的默认位置,启用 JavaScript 以及更改 PHP 版本。请看以下截图。 + +![Create A New PHP Project in Eclipse][3] + +你可以单击 _Finish_ 按钮创建项目,或按 _Next_ 配置其他选项,例如添加包含和构建路径。在大多数情况下,你无需更改这些设置。 + +创建项目后,右键单击项目文件夹,然后选择 _New→PHP File_ 将新的 PHP 文件添加到项目。在本教程中,我将其命名为 _index.php_,这是每个 PHP 项目中公认的默认文件。 + +![][4] + +接着在新文件中添加代码。 + +![Demo PHP code][5] + +在上面的例子中,我在同一页面上使用了 CSS、JavaScript 和 PHP 标记,主要是为了展示 IDE 能够支持所有这些标记。 + +页面完成后,你可以将文件移至 Web 服务器文档根目录或在项目目录中创建一个开发 PHP 服务器来查看输出。 + +借助 Eclipse 中的内置终端,我们可以直接在 IDE 中启动 PHP 开发服务器。只需单击工具栏上的终端图标(![Terminal Icon][6]),然后单击 _OK_。在新终端中,进入项目目录,然后运行以下命令: + +``` +php -S localhost:8080 -t . index.php +``` + +![Terminal output][7] + +现在,打开浏览器并进入 。如果按照说明正确完成了所有操作,并且代码没有错误,那么你将在浏览器中看到 PHP 脚本的输出。 + +![PHP output in Fedora][8] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/php-development-on-fedora-with-eclipse/ + +作者:[Mehdi Haghgoo][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/powergame/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/php-eclipse-816x346.png +[2]: https://projects.eclipse.org/projects/eclipse +[3]: https://fedoramagazine.org/wp-content/uploads/2020/02/Screenshot-from-2020-02-07-01-58-39.png +[4]: https://fedoramagazine.org/wp-content/uploads/2020/02/Screenshot-from-2020-02-07-02-02-05-1024x576.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/02/code-1024x916.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/02/Screenshot-from-2020-02-07-03-50-05.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/02/terminal-1024x239.png +[8]: https://fedoramagazine.org/wp-content/uploads/2020/02/output.png From c2fb406528fd3c1016b4ab1191b2b1fa331e88eb Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 3 Mar 2020 08:26:51 +0800 Subject: [PATCH 176/260] translating --- .../tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md b/sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md index 6443a00482..6a93204805 100644 --- a/sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md +++ b/sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 62bbf6fd7e9a6c67d2ad092ac81bd96fc6541890 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Mar 2020 10:13:04 +0800 Subject: [PATCH 177/260] PRF @wxy --- ...1 Troubleshooting hardware problems in Linux.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181231 Troubleshooting hardware problems in Linux.md b/translated/tech/20181231 Troubleshooting hardware problems in Linux.md index eee2160639..cffbb8f5b2 100644 --- a/translated/tech/20181231 Troubleshooting hardware problems in Linux.md +++ b/translated/tech/20181231 Troubleshooting hardware problems in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Troubleshooting hardware problems in Linux) @@ -12,11 +12,11 @@ Linux 硬件故障排除指南 > 了解是什么原因导致你的 Linux 硬件发生故障,以便你可以将其恢复并快速运行。 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_other11x_cc.png?itok=I_kCDYj0) +![](https://img.linux.net.cn/data/attachment/album/202003/03/101312zcazy02wl2g8uhy1.jpg) -[Linux 服务器][1]在物理机、虚拟化、私有云、公共云和混合云等许多不同种类的基础设施中运行着关键的业务应用程序。对于 Linux 系统管理员来说,了解如何管理 Linux 硬件基础设施(包括与 [网络][2]、存储、Linux 容器相关的软件定义的功能)和 Linux 服务器上的多种工具非常重要。 +[Linux 服务器][1]在物理机、虚拟化、私有云、公共云和混合云等许多不同种类的基础设施中运行着关键的业务应用程序。对于 Linux 系统管理员来说,了解如何管理 Linux 硬件基础设施(包括与 [网络][2]、存储、Linux 容器相关的软件定义功能)和 Linux 服务器上的多种工具非常重要。 -在 Linux 上进行故障排除和解决与硬件相关的问题可能需要一些时间。即使是经验丰富的系统管理员,有时也会花费数小时来解决神秘的硬件和软件差异。 +在 Linux 上进行排除和解决与硬件相关的问题可能需要一些时间。即使是经验丰富的系统管理员,有时也会花费数小时来解决神秘的硬件和软件差异。 以下提示可以使你更快、更轻松地对 Linux 中的硬件进行故障排除。许多不同的事情都可能导致 Linux 硬件出现问题。在开始诊断它们之前,明智的做法是了解最常见的问题以及最有可能找到问题的地方。 @@ -54,7 +54,7 @@ xvdb    202:16   0  20G  0 disk .... ``` -### 深入到多个日志当中 +### 深入到各个日志当中 使用 `dmesg` 可以找出内核最新消息中的错误和警告。例如,这是 `dmesg | more` 命令的输出: @@ -93,7 +93,7 @@ Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domai ### 分析网络功能 -你可能有成千上万的云原生应用程序在一个复杂的网络环境中为业务提供服务。其中可能包括虚拟化、多云和混合云。这意味着,作为故障排除的一部分,你应该分析网络连接是否正常工作。弄清 Linux 服务器中网络功能的有用命令包括:`ip addr`、`traceroute`、`nslookup`、`dig` 和 `ping` 等。例如,这是 `ip addr show` 命令的输出: +你可能有成千上万的云原生应用程序在一个复杂的网络环境中为业务提供服务,其中可能包括虚拟化、多云和混合云。这意味着,作为故障排除的一部分,你应该分析网络连接是否正常工作。弄清 Linux 服务器中网络功能的有用命令包括:`ip addr`、`traceroute`、`nslookup`、`dig` 和 `ping` 等。例如,这是 `ip addr show` 命令的输出: ``` # ip addr show @@ -129,7 +129,7 @@ via: https://opensource.com/article/18/12/troubleshooting-hardware-problems-linu 作者:[Daniel Oh][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 55baf904b467ff0b6fef690da266577a0bbbf395 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Mar 2020 10:13:45 +0800 Subject: [PATCH 178/260] PUB @wxy https://linux.cn/article-11953-1.html --- .../20181231 Troubleshooting hardware problems in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181231 Troubleshooting hardware problems in Linux.md (99%) diff --git a/translated/tech/20181231 Troubleshooting hardware problems in Linux.md b/published/20181231 Troubleshooting hardware problems in Linux.md similarity index 99% rename from translated/tech/20181231 Troubleshooting hardware problems in Linux.md rename to published/20181231 Troubleshooting hardware problems in Linux.md index cffbb8f5b2..34dbed5f44 100644 --- a/translated/tech/20181231 Troubleshooting hardware problems in Linux.md +++ b/published/20181231 Troubleshooting hardware problems in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11953-1.html) [#]: subject: (Troubleshooting hardware problems in Linux) [#]: via: (https://opensource.com/article/18/12/troubleshooting-hardware-problems-linux) [#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) From 03cb1976135ed46c877cff013e3bc004872b6067 Mon Sep 17 00:00:00 2001 From: MFG <48886453+MFGJT@users.noreply.github.com> Date: Tue, 3 Mar 2020 13:33:53 +0800 Subject: [PATCH 179/260] Update 20190422 9 ways to save the planet.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2020.03.03申领原文 --- sources/tech/20190422 9 ways to save the planet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190422 9 ways to save the planet.md b/sources/tech/20190422 9 ways to save the planet.md index d3301006cc..a448fa7660 100644 --- a/sources/tech/20190422 9 ways to save the planet.md +++ b/sources/tech/20190422 9 ways to save the planet.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MFGJT) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 67c1663127915b8fc43b632c27866430f200b9c9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Mar 2020 20:59:46 +0800 Subject: [PATCH 180/260] APL --- ...to set up your own fast, private open source mesh network.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200214 How to set up your own fast, private open source mesh network.md b/sources/tech/20200214 How to set up your own fast, private open source mesh network.md index b68b57da3d..fa8b645527 100644 --- a/sources/tech/20200214 How to set up your own fast, private open source mesh network.md +++ b/sources/tech/20200214 How to set up your own fast, private open source mesh network.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7095936674f53ee70f3ef8325fb05089a608b1d2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Mar 2020 21:34:12 +0800 Subject: [PATCH 181/260] TSL --- ... fast, private open source mesh network.md | 110 ----------------- ... fast, private open source mesh network.md | 112 ++++++++++++++++++ 2 files changed, 112 insertions(+), 110 deletions(-) delete mode 100644 sources/tech/20200214 How to set up your own fast, private open source mesh network.md create mode 100644 translated/tech/20200214 How to set up your own fast, private open source mesh network.md diff --git a/sources/tech/20200214 How to set up your own fast, private open source mesh network.md b/sources/tech/20200214 How to set up your own fast, private open source mesh network.md deleted file mode 100644 index fa8b645527..0000000000 --- a/sources/tech/20200214 How to set up your own fast, private open source mesh network.md +++ /dev/null @@ -1,110 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to set up your own fast, private open source mesh network) -[#]: via: (https://opensource.com/article/20/2/mesh-network-freemesh) -[#]: author: (Spencer Thomason https://opensource.com/users/spencerthomason) - -How to set up your own fast, private open source mesh network -====== -FreeMesh is an affordable, performant, privacy-respecting mesh system -that installs in less than 10 minutes. -![people on top of a connected globe][1] - -The [FreeMesh][2] system promises to bring fully open source mesh networking to the masses. I recently had a chance to test it; it installed quickly, and the performance was great—especially for the price. - -### Why mesh and open source? - -The reason to use open source is simple: privacy. With FreeMesh, your data is your own. It doesn't track or collect data. Don't trust it? You can easily check—it's open source, after all! With some other popular mesh solutions, say those provided by very large tech conglomerates, would you trust them with your data? - -Another important factor: updates. FreeMesh says it is committed to pushing out security and performance updates regularly. What about 10 years from now? With an open source solution, you are free to update the product for as long as you want. - -So why mesh? In a mesh network, multiple wireless routers work together to broadcast a single, very large wireless network. Each router in a mesh network intelligently communicates with the other(s) to provide the best "path" for your data. The following images from FreeMesh's website highlight the difference between using a single wireless router and a mesh network. The red network represents a single wireless router, and the green is a mesh network. - -![Single-router network][3] | ![Mesh network][4] ----|--- - -### Get the equipment - -To get started with FreeMesh, [order a kit][5]. Two kits are available: standard and 4G LTE. - -The 4G LTE kit, as the name suggests, supports cellular data connections. This feature is a rarity in the consumer networking space, and it will be _very_ useful to some folks. You can set up a portable mesh network anywhere with power and cell service with full fast-failover capability. - -The FreeMesh kits come with a primary router and two nodes. The router and nodes use 802.11ac, 802.11r, and 802.11s standards. The included firmware runs a customized version of [OpenWrt][6], a Linux distro for embedded devices. - -The FreeMesh router has some really good specs: - - * **CPU:** Dual-core 880MHz MediaTek MT7621AT (two cores/four threads!) - * **RAM:** DDR3 512MB - * **Interfaces:** 1x GbE WAN, 4x GbE LAN, 1x USB 2.0 ports, 1x microSD card slot, 1x SIM slot - * **Antenna:** 2x 5dBi 2.4GHz, 2x 5dBi 5GHz, 2x 3dBi 3G/4G (built-in) - * **4G LTE modem:** LTE category 4 module, 150Mbps downlink and 50Mbps uplink - - - -### Setup - -Setup is easy, and FreeMesh's [README][7] offers simple instructions and diagrams. Start by setting up the primary router first. Then follow these simple steps: - - 1. Connect the first node (blue WAN port) to the primary router (yellow LAN port). -![FreeMesh setup step 1][8] - 2. Wait about 30 to 60 seconds. The node will flash its LEDs when the setup is complete. -![FreeMesh setup step 2][9] - 3. Move the node to another location. - - - -That's it! There is no manual setup required for the nodes; you simply plug them into the primary router, and it does the rest. You can add more nodes the same way; just repeat the steps above. - -### Features - -Out of the box, FreeMesh runs a combination of OpenWRT and LuCI. It has all the features you'd expect from a router. Want to install new features or packages? SSH in and start hacking! - -![Real-time load on FreeMesh network][10] - -![Overview of FreeMesh network][11] - -![OpenWrt status report][12] - -### Performance - -After setting up the FreeMesh system, I moved the nodes to various places around my house. I used [iPerf][13] to test the bandwidth and was getting around 150Mbps. WiFi can be affected by any number of environmental variables, so your mileage may vary. Distance between the nodes and the primary router also plays a large factor in bandwidth. - -However, the real advantage of a mesh network isn't its top-end speed but much better average speed across a space. Even at the far reaches of my home, I was still able to stream videos and work without interruption. I was even able to work in my backyard. I simply repositioned one of the nodes in front of a window before heading outside. - -### Conclusion - -FreeMesh is really compelling; it offers performance, privacy, and price, all in a simple, open source package. - -In my experience, setup is a breeze, and it is more than fast enough. The range is excellent and far exceeds any single-router setup. You are free to hack and customize your FreeMesh setup, but I didn't feel the need to. It has everything I need out of the box. - -If you are looking for an affordable, performant, privacy-respecting mesh system that installs in less than 10 minutes, you might want to consider FreeMesh. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/mesh-network-freemesh - -作者:[Spencer Thomason][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/spencerthomason -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-networking.png?itok=fHmulI9p (people on top of a connected globe) -[2]: https://freemeshwireless.com/ -[3]: https://opensource.com/sites/default/files/uploads/singlerouternetwork.png (Single-router network) -[4]: https://opensource.com/sites/default/files/uploads/meshnetwork.png (Mesh network) -[5]: https://freemeshwireless.com/#pricing -[6]: https://openwrt.org/ -[7]: https://gitlab.com/slthomason/freemesh/-/blob/master/README.md -[8]: https://opensource.com/sites/default/files/uploads/connecttorouter.png (FreeMesh setup step 1) -[9]: https://opensource.com/sites/default/files/uploads/setupcomplete.png (FreeMesh setup step 2) -[10]: https://opensource.com/sites/default/files/uploads/freemeshrealtimeload.png (Real-time load on FreeMesh network) -[11]: https://opensource.com/sites/default/files/uploads/freemeshwirelessoverview.png (Overview of FreeMesh network) -[12]: https://opensource.com/sites/default/files/uploads/openwrt.png (OpenWrt status report) -[13]: https://opensource.com/article/20/1/internet-speed-tests diff --git a/translated/tech/20200214 How to set up your own fast, private open source mesh network.md b/translated/tech/20200214 How to set up your own fast, private open source mesh network.md new file mode 100644 index 0000000000..1ce5cdae9d --- /dev/null +++ b/translated/tech/20200214 How to set up your own fast, private open source mesh network.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to set up your own fast, private open source mesh network) +[#]: via: (https://opensource.com/article/20/2/mesh-network-freemesh) +[#]: author: (Spencer Thomason https://opensource.com/users/spencerthomason) + +如何建立自己的快速、私有的开源网状网络 +====== + +> 只需要不到 10 分钟的安装时间,就可以用 FreeMesh 搭建一个经济实惠、性能卓越、尊重隐私的网格系统。 + +![people on top of a connected globe][1] + +[FreeMesh][2] 系统有望为大众带来完全开源的网格网络mesh network。我最近有机会进行了测试;它安装迅速,性能非常好 —— 特别是相对它的价格而言。 + +### 为什么要网格化和开源? + +使用开源的原因很简单:隐私。有了 FreeMesh,你的数据就是你自己的。它不会跟踪或收集数据。不相信吗?毕竟,你可以轻松检查 —— 它是开源的!而其它大型高科技企业集团提供的一些流行的网格解决方案,你是否相信它们会保护你的数据? + +另一个重要因素:更新。FreeMesh 表示,它将致力于定期发布安全性和性能更新。从现在起到 10 年后呢?使用开放源代码解决方案,你可以根据需要自由地更新产品。 + +那么为什么要用网格呢?在网状网络中,多个无线路由器一起工作以广播单个超大型的无线网络。网状网络中的每个路由器都可与其他路由器智能地通信,以便为你的数据提供最佳的“路径”。FreeMesh 网站上的以下图片突出显示了使用单个无线路由器和网状网络之间的区别。 红色网络表示单个无线路由器,绿色网络是网状网络。 + +![单路由器网络] [3] + +![网状网络] [4] + +### 采购设备 + +要开始使用 FreeMesh,请[订购套件][5]。它提供两种套件:标准套件和 4G LTE。 + +顾名思义,4G LTE 套件支持蜂窝数据连接。此功能在消费级网络领域非常罕见,但对某些人来说非常有用。你可以在提供电源和电池的任何地方建立具有完整的快速故障转移功能的便携式网状网络。 + +FreeMesh 套件带有一个主路由器和两个节点。路由器和节点使用 802.11ac、802.11r 和 802.11s 标准。随附的固件运行定制版本的 [OpenWrt] [6],这是嵌入式设备的 Linux 发行版。 + +FreeMesh 路由器的一些规格非常好: + +* CPU:双核 880MHz MediaTek MT7621AT(双核/四线程!) +* 内存:DDR3 512MB +* 接口:1 个 GbE WAN、4 个 GbE LAN、1 个 USB 2.0 端口、1 个 microSD 卡插槽、1 个 SIM 插槽 +* 天线:2 个 5dBi 2.4GHz、2 个 5dBi 5GHz、2 个 3dBi 3G/4G(内置) +* 4G LTE 调制解调器:LTE 4 类模块,下行 150Mbps/上行 50Mbps + +### 设置 + +设置很容易,FreeMesh 的 [README][7] 提供了简单的说明和图表。首先首先设置主路由器。然后按照以下简单步骤操作: + +1、将第一个节点(蓝色 WAN 端口)连接到主路由器(黄色 LAN 端口)。 + +![FreeMesh 设置步骤 1][8] + +2、等待约 30 至 60 秒。设置完成后,节点将闪烁其 LED。 + +![FreeMesh 设置步骤 2][9] + +3、将节点移到另一个位置。 + +仅此而已!节点不需要手动设置。你只需将它们插入主路由器,其余的工作就完成了。你可以以相同的方式添加更多节点;只需重复上述步骤即可。 + +### 功能 + +FreeMesh 是开箱即用的,它由 OpenWRT 和 LuCI 组合而成。它具有你期望路由器提供的所有功能。是否要安装新功能或软件包?SSH 连入并开始魔改! + +![FreeMesh 网络上的实时负载][10] + +![FreeMesh 网络概览][11] + +![OpenWrt 状态报告][12] + +### 性能如何 + +设置完 FreeMesh 系统后,我将节点移动到了房屋周围的各个地方。我使用 [iPerf][13] 测试带宽,它达到了约 150Mbps。WiFi 可能会受到许多环境变量的影响,因此你的结果可能会有所不同。节点与主路由器之间的距离在带宽中也有很大的影响。 + +但是,网状网络的真正优势不是高峰速度,而是整个空间的平均速度要好得多。即使在我家很远的地方,我仍然能够流媒体播放视频并正常工作。我甚至可以在后院工作。在出门之前,我只是将一个节点重新放在窗口前面而已。 + +### 结论 + +FreeMesh 确实令人信服。它以简单、开源的形式为你提供高性价比和隐私。 + +以我的经验,设置非常容易,而且足够快。覆盖范围非常好,远远超过了任何单路由器环境。你可以随意魔改和定制 FreeMesh 设置,但是我觉得没有必要。它提供了我需要的一切。 + +如果你正在寻找价格可承受、性能良好且尊重隐私的网格系统,且该系统可以在不到 10 分钟的时间内安装完毕,你可以考虑一下 FreeMesh。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/mesh-network-freemesh + +作者:[Spencer Thomason][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/spencerthomason +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-networking.png?itok=fHmulI9p (people on top of a connected globe) +[2]: https://freemeshwireless.com/ +[3]: https://opensource.com/sites/default/files/uploads/singlerouternetwork.png (Single-router network) +[4]: https://opensource.com/sites/default/files/uploads/meshnetwork.png (Mesh network) +[5]: https://freemeshwireless.com/#pricing +[6]: https://openwrt.org/ +[7]: https://gitlab.com/slthomason/freemesh/-/blob/master/README.md +[8]: https://opensource.com/sites/default/files/uploads/connecttorouter.png (FreeMesh setup step 1) +[9]: https://opensource.com/sites/default/files/uploads/setupcomplete.png (FreeMesh setup step 2) +[10]: https://opensource.com/sites/default/files/uploads/freemeshrealtimeload.png (Real-time load on FreeMesh network) +[11]: https://opensource.com/sites/default/files/uploads/freemeshwirelessoverview.png (Overview of FreeMesh network) +[12]: https://opensource.com/sites/default/files/uploads/openwrt.png (OpenWrt status report) +[13]: https://opensource.com/article/20/1/internet-speed-tests From 313bfe0bc3ae2e96975d6f89c04e45c095da1f5b Mon Sep 17 00:00:00 2001 From: wetshoes <43409711+Fisherman110@users.noreply.github.com> Date: Tue, 3 Mar 2020 22:20:13 +0800 Subject: [PATCH 182/260] Update 20180306 Exploring free and open web fonts.md --- sources/tech/20180306 Exploring free and open web fonts.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180306 Exploring free and open web fonts.md b/sources/tech/20180306 Exploring free and open web fonts.md index 533286ca2c..d01accfbce 100644 --- a/sources/tech/20180306 Exploring free and open web fonts.md +++ b/sources/tech/20180306 Exploring free and open web fonts.md @@ -1,3 +1,5 @@ +Fisherman110 translating + Exploring free and open web fonts ====== From 52fbbba1b8db0840303587bb1fe08dad97cceb4f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Mar 2020 00:59:25 +0800 Subject: [PATCH 183/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200304=20Drauge?= =?UTF-8?q?r=20OS=20Linux=20Aims=20to=20Bring=20Console=20Gaming=20Experie?= =?UTF-8?q?nce=20on=20the=20Desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md --- ...onsole Gaming Experience on the Desktop.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md diff --git a/sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md b/sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md new file mode 100644 index 0000000000..5cd5c57024 --- /dev/null +++ b/sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop) +[#]: via: (https://itsfoss.com/drauger-os/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop +====== + +For years (or decades) people complained that one of the reasons to not [use Linux][1] is lack of mainstream games. [Gaming on Linux][2] has improved drastically in last few years specially with the [introduction of Steam Proton][3] project that enables you to [play a lot of Windows-only games on Linux][4]. + +This also has encourages several [Linux distributions centered around gaming][5]. Take [Lakka][6] for example. You can [turn your old computer into a retro gaming console thanks to Lakka Linux][7]. + +Another such gaming focused Linux distribution is [Draguer OS][8] and we are going to take a look at it today. + +### What is Drauger OS? + +Accord to [the project’s website][9], “Drauger OS is a Linux desktop gaming operating system. It aims to provide a platform for gamers to use where they can get great performance without sacrificing their security. Furthermore, it aims to make it easy for anyone to game, whether they use a keyboard and mouse, or some sort of controller.” + +They stress that Drauger OS is not for everyday use. As such, many of the productivity tools that most other distros come with are not in Drauger OS. + +![Drauger OS 7.4.1][10] + +Drauger OS is [based][9] on the Ubuntu. The current version (7.4.1 Jiangshi) uses “[Liquorix][11] low latency Linux kernel, a pre-compiled ZEN kernel designed with a balance between latency and throughput in mind”. However, that will be changing in the next release. They only have one desktop environment choice, a modified version of [Xfce][12]. + +Drauger OS has several applications and tools installed out of the box to improve the gaming experience. These include: + + * [PlayOnLinux][13] + * WINE + * [Lutris][14] + * Steam + * [DXVK][15] + + + +It also has an interesting set of tools that are not gaming related. [Drauger Installer][16] is a .deb installer and alternative to Gdebi. [Multiple Repository App Installer][17] (mrai) is “an AUR-helper-like script for Debian-based Linux Operating Systems”. Mrai is designed to work with apt, snaps, flatpaks, and can install apps from GitHub. + +Interestingly, Drauger OS’ name is an error. Lead dev [Thomas Castleman][18] (aka batcastle) has intended to name his distro Draugr, but had mistyped the name. In [episode 23][19] of the Drauger OS podcast, Castleman said the name will stay misspelled because it would be a lot of work to correct it. According to [Wikipedia][20], a draugr is “an undead creature from Norse mythology”. + +Yes, you read that correctly. Drauger OS is one of only a few distros that have its own [podcast][21]. When asked about it, Castleman told me that “I wanted to ensure that we had the maximum transparency possible with our community, no matter their circumstances.” Most of the time, the podcast is an audio version of the Drauger OS blog, but sometimes they use it to make an announcement when they don’t have time to write a blog post. + +### The Future for Drauger OS + +![Drauger OS][22] + +The developers behind Druager OS are working on their next major release: 7.5.1. This release will be based on Ubuntu 19.10. There will be three major changes. First, the Liquorix kernel will be [replaced][23] with “a kernel we are building in-house.” This kernel will be based on the Linux Kernel GitHub repository, “so it’s about as vanilla as it gets”. + +The second major change in the new release will a new layout for their desktop. Based on user feedback, they have decided to change it to something that looks more GNOME-like. + +Thirdly, they are dropping SystemBack as their backup tool and installer. They have instead written a new [installer][24] from scratch. + +The Dev team is also working on an [ARM version][25] of Drauger OS. They hope to release it sometime in 2022. + +### System requirements for Draguer OS + +The Drauger OS [system requirements][25] are pretty modest. Keep in mind that Drauger OS will only run on 64-bit systems. + +#### Minimum system requirements + + * CPU: Dual-Core, 1.8GHz, 64-bit processor + * RAM: 1 GB + * Storage: 16 GB + * Graphics Processor: Integrated + * Screen Resolution: 1024×768 at 60Hz + * External Ports: 1 Port for Display (HDMI / DisplayPort / VGA / DVI), 2 USB Ports for Installation USB Drive and Keyboard (Mouse optional, but recommended) + + + +#### Recommended system requirements + + * CPU: Quad-Core, 2.2Ghz, 64-bit processor + * RAM: 4 GB + * Storage: 128 GB + * Graphics Processor: NVIDIA GTX 1050, AMD RX 460, or equivalent card + * Screen Resolution: 1080p at 60Hz + * External Ports: 1 Port for Display (HDMI / DisplayPort / VGA / DVI), 3 USB Ports for Installation USB Drive, Keyboard, and Mouse, 1 Audio Out Port + + + +### How you can help out Drauger OS + +There are several ways that you can help out the Drauger OS if you are interestedin doing so. They are always looking for [financial support][26] to keep development going. + +If you want yo contribute code, they are looking for people with experience in BASH, C++, and Python. All of their code is up on [GitHub][27]. You can also [contact][28] them on social media. + +### Final Thoughts + +Drauger OS is quite a project. I’ve seen a couple of other [gaming-oriented distributions][29], but Drauger OS is single-minded in its focus on gaming. Since I am more of a casual gamer, this distro doesn’t appeal to me personally. But, I can see how it could lure gaming enthusiasts to Linux. I wish them good luck in their future releases. + +What are your thoughts on this gaming-only distro? What is your favorite Linux gaming solution? Please 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][30]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/drauger-os/ + +作者:[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://itsfoss.com/why-use-linux/ +[2]: https://itsfoss.com/linux-gaming-guide/ +[3]: https://itsfoss.com/steam-play-proton/ +[4]: https://itsfoss.com/steam-play/ +[5]: https://itsfoss.com/linux-gaming-distributions/ +[6]: http://www.lakka.tv/ +[7]: https://itsfoss.com/lakka-retrogaming-linux/ +[8]: https://draugeros.org/go/ +[9]: https://www.draugeros.org/go/about/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/drauger-os-7.4.1.jpg?ssl=1 +[11]: https://liquorix.net/ +[12]: https://www.xfce.org/ +[13]: https://www.playonlinux.com/en/ +[14]: https://lutris.net/ +[15]: https://github.com/doitsujin/dxvk +[16]: https://github.com/drauger-os-development/drauger-installer +[17]: https://github.com/drauger-os-development/mrai +[18]: https://github.com/Batcastle +[19]: https://anchor.fm/drauger-os/episodes/Episode-23-eapu47 +[20]: https://en.wikipedia.org/wiki/Draugr +[21]: https://anchor.fm/drauger-os +[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/drauger-os-7.5.1.png?ssl=1 +[23]: https://www.draugeros.org/go/2020/01/20/major-changes-in-drauger-os-7-5-1/ +[24]: https://github.com/drauger-os-development/system-installer +[25]: https://www.draugeros.org/go/system-requirements/ +[26]: https://www.draugeros.org/go/contribute/ +[27]: https://github.com/drauger-os-development +[28]: https://www.draugeros.org/go/contact-us/ +[29]: https://itsfoss.com/manjaro-gaming-linux/ +[30]: https://reddit.com/r/linuxusersgroup From 6988bbe4e11d1694c26b65fb6cf8ffc434c41974 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Mar 2020 01:01:24 +0800 Subject: [PATCH 184/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200303=20Most-u?= =?UTF-8?q?sed=20libraries,=20open=20source=20adoption,=20and=20more=20ind?= =?UTF-8?q?ustry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200303 Most-used libraries, open source adoption, and more industry trends.md --- ...urce adoption, and more industry trends.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20200303 Most-used libraries, open source adoption, and more industry trends.md diff --git a/sources/tech/20200303 Most-used libraries, open source adoption, and more industry trends.md b/sources/tech/20200303 Most-used libraries, open source adoption, and more industry trends.md new file mode 100644 index 0000000000..769f4f550e --- /dev/null +++ b/sources/tech/20200303 Most-used libraries, open source adoption, and more industry trends.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Most-used libraries, open source adoption, and more industry trends) +[#]: via: (https://opensource.com/article/20/3/libraries-5G-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Most-used libraries, open source adoption, and more industry trends +====== +A weekly look at open source community and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [Most-used libraries revealed – plus 10 things developers should be doing to keep their code secure][2] + +> “The report begins to give us an inventory of the most important shared software and potential vulnerabilities and is the first step to understand more about these projects so that we can create tools and standards that results in trust and transparency in software," explained Jim Zemlin, executive director at the Linux Foundation, in a statement. + +**The impact**: Importantly, there is also a great list of packages for backdoors here. + +## [Survey: Open source adoption, quality gains][3] + +> Overall, the survey finds there has been [a marked shift away from proprietary software][4]. Only 42% said that more than half of the software they use today is proprietary, down from 55% a year ago. Two years from now only 32% said they expect proprietary software to account for more than half their portfolio. On average, respondents said 36% of their organization’s software is open source, which in two years is expected to increase to 44% in two years. A total of 77% said they would increase usage of open source software over the next 12 months. + +**The impact**: There is a clear virtuous cycle of companies getting more comfortable with open source and more open source software being created. If there isn't already, there will be a rule 34 about open source software. + +## [5G must go cloud-native from edge to core][5] + +> A containerised core will be the heart of cloud-native 5G networks. Managing and scaling networking apps in containers using a modular microservices approach will help service providers to dynamically orchestrate and grow service capacity across a distributed architecture. + +**The impact**: When you're building something complicated and reliable, you really can't look past starting with open source software. Unless you want to be in a foot race against "a Kawasaki" (that's a motorbike, right?). + +## [High-performance object storage, Kubernetes, + why you can't containerize a storage appliance][6] + +> True multi-tenancy isn’t possible unless the storage system is extremely lightweight and able to be packaged with the application stack. If the storage system takes too many resources or contains too many APIs, it won’t be possible to pack many tenants on the same infrastructure. + +**The impact**: The title of this post is a challenge to someone much more skilled and knowledgable than I. + +_I hope you enjoyed this list and come back next week for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/libraries-5G-more-industry-trends + +作者:[Tim Hildred][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/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://www.theregister.co.uk/2020/02/20/linux_foundation_report/ +[3]: https://devops.com/surevey-sees-open-source-adoption-quality-gains/ +[4]: https://devops.com/devops-deeper-dive-devops-accelerates-open-source-innovation-pace/ +[5]: https://www.5gradar.com/features/5g-must-go-cloud-native-from-edge-to-core +[6]: https://blog.min.io/high-performance-object-storage-with-kubernetes/ From 3508b38c19610121c0558ee9dd10abae5b4f2320 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Mar 2020 01:05:06 +0800 Subject: [PATCH 185/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200303=20Gettin?= =?UTF-8?q?g=20started=20with=20the=20Rust=20package=20manager,=20Cargo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200303 Getting started with the Rust package manager, Cargo.md --- ...ed with the Rust package manager, Cargo.md | 607 ++++++++++++++++++ 1 file changed, 607 insertions(+) create mode 100644 sources/tech/20200303 Getting started with the Rust package manager, Cargo.md diff --git a/sources/tech/20200303 Getting started with the Rust package manager, Cargo.md b/sources/tech/20200303 Getting started with the Rust package manager, Cargo.md new file mode 100644 index 0000000000..d77410b904 --- /dev/null +++ b/sources/tech/20200303 Getting started with the Rust package manager, Cargo.md @@ -0,0 +1,607 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with the Rust package manager, Cargo) +[#]: via: (https://opensource.com/article/20/3/rust-cargo) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +Getting started with the Rust package manager, Cargo +====== +Get to know Rust's package manager and build tool. +![Shipping containers stacked in a yard][1] + +[Rust][2] is a modern programming language that provides performance, reliability, and productivity. It has consistently been voted as the [most-loved language][3] on StackOverflow surveys for a few years now. + +In addition to being a great programming language, Rust also features a build system and package manager called Cargo. Cargo handles a lot of tasks, like building code, downloading libraries or dependencies, and so on. The two are bundled together, so you get Cargo when you install Rust. + +### Installing Rust and Cargo + +Before getting started, you need to install Rust and Cargo. The Rust project provides a downloadable script to handle the installation. To get the script, open a browser to [https://sh.rustup.rs][4] and save the file. Read the script to make sure you're happy with what it intends to do, and then run it: + + +``` +`$ sh ./rustup.rs` +``` + +You can also refer to the [Install Rust][5] webpage for more information. + +After installing Rust and Cargo, you must source the env file: + + +``` +`$ source $HOME/.cargo/env` +``` + +Better yet, add the required directory to your PATH variable: + + +``` +`$ source $HOME/.cargo/env` +``` + +If you prefer to use your package manager (such as DNF or Apt on Linux), look for Rust and Cargo packages in your distribution's repositories and install accordingly. For example: + + +``` +`$ dnf install rust cargo` +``` + +Once they're installed and set up, verify which versions of Rust and Cargo you have: + + +``` +$ rustc --version +rustc 1.41.0 (5e1a79984 2020-01-27) +$ cargo --version +cargo 1.41.0 (626f0f40e 2019-12-03) +``` + +### Building and running Rust by hand + +Start with a simple program that prints "Hello, world!" on the screen. Open your favorite text editor and type the following program: + + +``` +$ cat hello.rs +fn main() { +    println!("Hello, world!"); +} +``` + +Save the file with an **.rs** extension to identify it as a Rust source code file. + +Compile your program using the Rust compiler, **rustc**: + + +``` +`$ rustc hello.rs` +``` + +After compilation, you will have a binary that has the same name as the source program: + + +``` +$ ls -l +total 2592 +-rwxr-xr-x. 1 user group 2647944 Feb 13 14:14 hello +-rw-r--r--. 1 user group      45 Feb 13 14:14 hello.rs +$ +``` + +Execute your program to verify that it runs as expected: + + +``` +$ ./hello +Hello, world! +``` + +These steps are sufficient for smaller programs or whenever you want to test out something quickly. However, when working on bigger programs involving multiple people, Cargo is the best way forward. + +### Creating a new package using Cargo + +Cargo is a build system and package manager for Rust. It helps developers download and manage dependencies and assists in creating Rust packages. Packages in Rust are often called "crates" in the Rust community, but in this article, the two words are interchangeable. Refer to the Cargo [FAQ][6] provided by the Rust community for clarification. + +If you need any help with Cargo's command-line utility, use the **\--help** or **-h** command-line argument: + + +``` +`$ cargo –help` +``` + +To create a new package, use the **new** keyword, followed by the package name. For this example, use **hello_opensource** as your new package name. After running the command, you will see a message confirming that Cargo has created a binary package with the given name: + + +``` +$ cargo new hello_opensource +     Created binary (application) `hello_opensource` package +``` + +Running a **tree** command to see the directory structure reports that some files and directories were created. First, it creates a directory with the name of the package, and within that directory is an **src** directory for your source code files: + + +``` +$ tree . +. +└── hello_opensource +    ├── Cargo.toml +    └── src +        └── main.rs + +2 directories, 2 files +``` + +Cargo not only creates a package, but it also creates a simple **Hello, world!** program. Open the **main.rs** file and have a look: + + +``` +$ cat hello_opensource/src/main.rs +fn main() { +    println!("Hello, world!"); +} +``` + +The next file to work with is **Cargo.toml**, which is a configuration file for your package. It contains information about the package, such as its name, version, author information, and Rust edition information. + +A program often depends on external libraries or dependencies to run, which enables you to write applications that perform tasks that you don't know how to code or you don't want to spend time coding. All your dependencies will be listed in this file. At this point, you do not have any dependencies for your new program. Open the **Cargo.toml** file and view its contents: + + +``` +$ cat hello_opensource/Cargo.toml +[package] +name = "hello_opensource" +version = "0.1.0" +authors = ["user <[user@mail.com][7]>"] +edition = "2018" + +# See more keys and their definitions at + +[dependencies] +``` + +### Building the program using Cargo + +So far, so good. Now that you have a package in place, build a binary (also called an executable). Before doing that, move into the package directory: + + +``` +`$ cd hello_opensource/` +``` + +You can use Cargo's **build** command to build the package. Notice the messages that say it is **Compiling** your program: + + +``` +$ cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.38s +``` + +Check what happens to your project directory after you run the **build** command: + + +``` +$ tree . +. +├── Cargo.lock +├── Cargo.toml +├── src +│   └── main.rs +└── target +    └── debug +        ├── build +        ├── deps +        │   ├── hello_opensource-147b8a0f466515dd +        │   └── hello_opensource-147b8a0f466515dd.d +        ├── examples +        ├── hello_opensource +        ├── hello_opensource.d +        └── incremental +            └── hello_opensource-3pouh4i8ttpvz +                ├── s-fkmhjmt8tj-x962ep-1hivstog8wvf +                │   ├── 1r37g6m45p8rx66m.o +                │   ├── 2469ykny0eqo592v.o +                │   ├── 2g5i2x8ie8zed30i.o +                │   ├── 2yrvd7azhgjog6zy.o +                │   ├── 3g9rrdr4hyk76jtd.o +                │   ├── dep-graph.bin +                │   ├── query-cache.bin +                │   ├── work-products.bin +                │   └── wqif2s56aj0qtct.o +                └── s-fkmhjmt8tj-x962ep.lock + +9 directories, 17 files +``` + +Wow! The compilations process produced a lot of intermediate files. Your binary, though, is saved in the **./target/debug** directory with the same name as your package. + +### Running your application using Cargo + +Now that your binary is built, run it using Cargo's **run** command. As expected, it prints **Hello, world!** on the screen. + + +``` +$ cargo run +    Finished dev [unoptimized + debuginfo] target(s) in 0.01s +     Running `target/debug/hello_opensource` +Hello, world! +``` + +Alternatively, you can run the binary directly, which is located at: + + +``` +$ ls -l ./target/debug/hello_opensource +-rwxr-xr-x. 2 root root 2655552 Feb 13 14:19 ./target/debug/hello_opensource +``` + +As expected, it produces the same results: + + +``` +$ ./target/debug/hello_opensource +Hello, world! +``` + +Say you need to rebuild your package and get rid of all the binaries and the intermediate files created by the earlier compilation process. Cargo provides a handy **clean** option to remove all intermediate files except the source code and other required files: + + +``` +$ cargo clean +$ tree . +. +├── Cargo.lock +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 3 files +``` + +Make some changes to the program and run it again to see how it works. For example, this minor change adds **Opensource** to the **Hello, world!** string: + + +``` +$ cat src/main.rs +fn main() { +    println!("Hello, Opensource world!"); +} +``` + +Now, build the program and run it again. This time you see **Hello, Opensource world!** displayed on the screen: + + +``` +$ cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.39s + +$ cargo run +    Finished dev [unoptimized + debuginfo] target(s) in 0.01s +     Running `target/debug/hello_opensource` +Hello, Opensource world! +``` + +### Adding dependencies using Cargo + +Cargo allows you to add dependencies that your program needs to run. Adding a dependency is extremely easy with Cargo. Every Rust package includes a **Cargo.toml** file, which contains a list (empty by default) of dependencies. Open the file in your favorite text editor, find the **[dependencies]** section, and add the library you want to include in your package. For example, to add the **rand** library as your dependency: + + +``` +$ cat Cargo.toml +[package] +name = "hello_opensource" +version = "0.1.0" +authors = ["test user <[test@mail.com][8]>"] +edition = "2018" + +# See more keys and their definitions at + +[dependencies] +rand = "0.3.14" +``` + +Try building your package to see what happens. + + +``` +$ cargo build +    Updating crates.io index +   Compiling libc v0.2.66 +   Compiling rand v0.4.6 +   Compiling rand v0.3.23 +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 4.48s +``` + +Cargo is now reaching out to [Crates.io][9], which is Rust's central repository for crates (or packages) and downloading and compiling **rand**. But wait—what about the **libc** package? You did not ask for **libc** to be installed. Well, the **rand** package is dependent on the **libc** package; hence, Cargo downloads and compiles **libc** as well. + +New versions of libraries keep coming, and Cargo provides an easy way to update all of their dependencies using the **update** command: + + +``` +`cargo update` +``` + +You can also choose to update specific libraries using the **-p** flag followed by the package name: + + +``` +`cargo update -p rand` +``` + +### Compiling and running with a single command + +So far, you have used **build** followed by **run** whenever you make changes to your program. There is an easier way: you can simply use the **run** command, which internally compiles and runs the program. To see how it works, first clean up your package directory: + + +``` +$ cargo clean +$ tree . +. +├── Cargo.lock +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 3 files +``` + +Now execute **run**. The output states that it compiled and then ran the program, and this means you don't need to explicitly run **build** each time: + + +``` +$ cargo run +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.41s +     Running `target/debug/hello_opensource` +Hello, world! +``` + +### Checking your code in development + +You often go through multiple iterations when developing a program. You need to ensure that your program has no coding errors and compiles fine. You don't need the overhead of generating the binary on each compilation. Cargo has you covered with a **check** option that compiles your code but skips the final step of generating an executable. + +Start by running **cargo clean** within your package directory: + + +``` +$ tree . +. +├── Cargo.lock +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 3 files +``` + +Now run the **check** command and see what changes were made to the directory: + + +``` +$ cargo check +    Checking hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.18s +``` + +The output shows that, even though intermediate files were created as part of the compilation process, the final binary or executable was not created. This saves some time, which matters a lot if the package is huge with thousands of lines of code: + + +``` +$ tree . +. +├── Cargo.lock +├── Cargo.toml +├── src +│   └── main.rs +└── target +    └── debug +        ├── build +        ├── deps +        │   ├── hello_opensource-842d9a06b2b6a19b.d +        │   └── libhello_opensource-842d9a06b2b6a19b.rmeta +        ├── examples +        └── incremental +            └── hello_opensource-1m3f8arxhgo1u +                ├── s-fkmhw18fjk-542o8d-18nukzzq7hpxe +                │   ├── dep-graph.bin +                │   ├── query-cache.bin +                │   └── work-products.bin +                └── s-fkmhw18fjk-542o8d.lock + +9 directories, 9 files +``` + +To see if you are really saving time, time the **build** and **check** commands and compare them. + +First, the **build** command: + + +``` +$ time cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.40s + +real    0m0.416s +user    0m0.251s +sys     0m0.199s +``` + +Clean the directory before running the **check** command: + + +``` +`$ cargo clean` +``` + +The **check** command: + + +``` +$ time cargo check +    Checking hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.15s + +real    0m0.166s +user    0m0.086s +sys     0m0.081s +``` + +Clearly, the **check** command is much faster. + +### Building external Rust packages + +Everything you've done so far will apply to any Rust crate you get from the internet. You simply need to download or clone the repository, move to the package folder, and run the **build** command, and you are good to go: + + +``` +git clone <github-like-url> +cd <package-folder> +cargo build +``` + +### Building optimized Rust programs using Cargo + +You've run **build** multiple times so far, but did you notice its output? No worries, build it again and watch closely: + + +``` +$ cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.36s +``` + +See the **[unoptimized + debuginfo]** text after each compilation? This means that the binary generated by Cargo includes a lot of debugging information and is not optimized for execution. Developers often go through multiple iterations of development and need this debugging information for analysis. Also, performance is not the immediate goal while developing software. Therefore, this is OK for now. + +However, once the software is ready for release, it doesn't need to have the debugging information anymore. But it does need to be optimized for best performance. In the final stages of development, you can use the **\--release** flag with **build**. Watch closely; you should see the **[optimized]** text after compilation: + + +``` +$ cargo build --release +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished release [optimized] target(s) in 0.29s +``` + +If you want to, you can go through the exercise to find out your time savings when running optimized vs. unoptimized software. + +### Creating a library vs. a binary using Cargo + +Any software program can be roughly categorized as either a standalone binary or a library. A standalone binary can be run as it is, even though it might make use of external libraries. A library, however, is utilized by another standalone binary. All the programs you've built so far in this tutorial are standalone binaries since that is Cargo's default. To create a **library**, add the **\--lib** option: + + +``` +$ cargo new --lib libhello +     Created library `libhello` package +``` + +This time, Cargo does not create a **main.rs** file; instead, it creates a **lib.rs** file. The code for your library should go here: + + +``` +$ tree . +. +└── libhello +    ├── Cargo.toml +    └── src +        └── lib.rs + +2 directories, 2 files +``` + +Knowing Cargo, don't be surprised that it put some code in your new library file. Find out what it added by moving to the package directory and viewing the file. By default, Cargo puts a test function within library files. + +### Running tests using Cargo + +Rust provides first-class support for unit and integration testing, and Cargo allows you to execute any of these tests: + + +``` +$ cd libhello/ + +$ cat src/lib.rs +#[cfg(test)] +mod tests { +    #[test] +    fn it_works() { +        assert_eq!(2 + 2, 4); +    } +} +``` + +Cargo has a handy **test** option to run any test that is present in your code. Try running the tests that Cargo put in the library code by default: + + +``` +$ cargo test +   Compiling libhello v0.1.0 (/opensource/libhello) +    Finished test [unoptimized + debuginfo] target(s) in 0.55s +     Running target/debug/deps/libhello-d52e35bb47939653 + +running 1 test +test tests::it_works ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out + +   Doc-tests libhello + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out +``` + +### Looking under Cargo's hood + +You may be interested in knowing what Cargo does under the hood when you run a command. After all, Cargo is, in many ways, a wrapper. To find out what it's doing, you can use the **-v** option with any Cargo command to output verbose information to the screen. + +Here are a couple of examples that run **build** and **clean** using the **-v** option. + +In the **build** command, you can see that the underlying **rustc** (Rust compiler) fired with the given command-line options: + + +``` +$ cargo build -v +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +     Running `rustc --edition=2018 --crate-name hello_opensource src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=147b8a0f466515dd -C extra-filename=-147b8a0f466515dd --out-dir /opensource/hello_opensource/target/debug/deps -C incremental=/opensource/hello_opensource/target/debug/incremental -L dependency=/opensource/hello_opensource/target/debug/deps` +    Finished dev [unoptimized + debuginfo] target(s) in 0.36s +``` + +Whereas the **clean** command shows that it is simply removing the directory that contains the intermediate files and the binary: + + +``` +$ cargo clean -v +    Removing /opensource/hello_opensource/target +``` + +### Don't let your skills get rusty + +To expand your skills, try writing and running a slightly more complex program using Rust and Cargo. Something simple will do: for instance, try listing all files in the current directory (it can be done in nine lines of code), or try echoing input back out at yourself. Small practice applications help you get comfortable with the syntax and the process of writing and testing code. + +This article offers plenty of information for budding Rust programmers to get started with Cargo. However, as you begin working on larger and more complicated programs, you'll need a more advanced understanding of Cargo. When you're ready for more, download and read the open source [Cargo Book][10] written by the Rust team, and see what you can create! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/rust-cargo + +作者:[Gaurav Kamathe][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/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-containers2.png?itok=idd8duC_ (Shipping containers stacked in a yard) +[2]: https://www.rust-lang.org/ +[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages +[4]: https://sh.rustup.rs/ +[5]: https://www.rust-lang.org/tools/install +[6]: https://doc.rust-lang.org/cargo/faq.html +[7]: mailto:user@mail.com +[8]: mailto:test@mail.com +[9]: http://crates.io +[10]: https://doc.rust-lang.org/cargo From 396b5d6cb440f3c07b8d7ff564da3db3ede12d25 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Mar 2020 01:06:15 +0800 Subject: [PATCH 186/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200303=20Gettin?= =?UTF-8?q?g=20started=20with=20lightweight=20alternatives=20to=20GNU=20Em?= =?UTF-8?q?acs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200303 Getting started with lightweight alternatives to GNU Emacs.md --- ...h lightweight alternatives to GNU Emacs.md | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 sources/tech/20200303 Getting started with lightweight alternatives to GNU Emacs.md diff --git a/sources/tech/20200303 Getting started with lightweight alternatives to GNU Emacs.md b/sources/tech/20200303 Getting started with lightweight alternatives to GNU Emacs.md new file mode 100644 index 0000000000..5f86c79b84 --- /dev/null +++ b/sources/tech/20200303 Getting started with lightweight alternatives to GNU Emacs.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with lightweight alternatives to GNU Emacs) +[#]: via: (https://opensource.com/article/20/3/lightweight-emacs) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Getting started with lightweight alternatives to GNU Emacs +====== +Slimmed-down (in size and features) alternatives allow you to take your +text editor anywhere you go. +![Text editor on a browser, in blue][1] + +I work on a lot of servers, and sometimes I find a host that hasn't installed [GNU Emacs][2]. There's usually a [GNU Nano][3] installation to keep me from resorting to [Vi][4], but I'm not used to Nano the way I am Emacs, and I inevitably run into complications when I try to save my document (**C-x** in Nano stands for Exit, and **C-s** locks Konsole). + +While it would be nice to have GNU Emacs available everywhere, it's a lot of program for making a simple update to a config file. My need for a small and lightweight emacs is what took me down the path of discovering MicroEmacs, Jove, and Zile—tiny, self-contained [emacsen][5] that you can put on a thumb drive, an SD card, and nearly any server, so you'll never be without an emacs editor. + +### Editing macros + +The term "emacs" is a somewhat generic term in the way that only open source produces, and a portmanteau. Before there was [GNU Emacs][6], there were collections of batch process scripts (called _macros_) that could perform common tasks for a user. For instance, if you often found yourself typing "teh" instead of "the," you could either go in and correct each one manually (no small feat when your editor can't even load the entire document into memory, as was often the case in the early 1980s), or you could invoke a macro to perform a quick swap of the "e" and "h." + +Eventually, these macros were bundled together into a package called editing macros, or EMACS for short. GNU Emacs is the most famous emacsen (yes, the -en suffix is used to describe many emacs, as in the word "oxen"), but it's not the only one. And it's certainly not the smallest. Quite the contrary, GNU Emacs is probably one of the largest. + +Fortunately, GNU Emacs is so popular that other emacs implementations tend to mimic most of the GNU version's basic controls. If you're looking for a basic, fast, and efficient editor that isn't Vim, you'll likely be happy with any of these options. + +### MicroEmacs + +![µemacs][7] + +[MicroEmacs][8], also known as uemacs (as in the Greek letter µ, which denotes "micro" in scientific notation), was written by Dave Conroy, but there's a long list of users who have cloned it and modified it. One user who maintains a personal version of µemacs is a programmer named Linus Torvalds, and his copy is available from his website, [kernel.org][9] (which also, incidentally, includes a small side project of his called [Linux][10]). + +#### Size + +It takes me five seconds to compile µemacs at the slowest setting I can impose on my computer, and the resulting binary is a mere 493KB. Admittedly, that's not literally "micro" compared to the typical size of a GNU Emacs download (1 millionth of 70MB is 70 bytes, by my calculation), but it's respectably small. For instance, it's easy enough to send it to yourself by email or over Signal, and certainly small enough to keep handy on every thumb drive or SD card you own. + +By default, Linus's version expects libcurses, but you can override this setting in the Makefile so that it uses libtermcap instead. The resulting binary is independent enough to run on most Linux boxes: + + +``` +$ ldd em +linux-vdso.so.1 +libtermcap.so.2 => /lib64/libtermcap.so.2 +libc.so.6 => /lib64/libc.so.6 +/lib64/ld-linux-x86-64.so.2 +``` + +#### Features + +The [keyboard shortcuts][11] are just as you'd expect. You can open files and edit them without ever realizing you're not in GNU Emacs. + +Some advanced features are missing. For instance, there's no vertical buffer split, although there is a horizontal split. There's no eval command, so you won't use µemacs for Lisp programming. + +The search function is also a little different from what you may be used to: instead of **C-s**, it's **M-s**, which could make all the difference if your terminal emulator accepts **Ctrl+S** as a freeze command. The help page for µemacs is very complete, so use **M-x help** to get familiar with what it has available. + +#### License + +The license for µemacs is custom to the project with a non-commercial condition. You're free to share, use, and modify µemacs, but you can't do anything commercial with it. +While not as liberal a policy as I typically prefer, it's a good-enough license for personal use; just don't build a business around it. + +### GNU Zile + +![GNU Zile][12] + +[GNU Zile][13] claims to be a development kit for text editors. It's meant as a framework to enable people to quickly develop their own custom text editor without having to reinvent common data structures. It's a great idea and probably very useful, but as I have no interest in making my own editor, I just use the example implementation that ships with its codebase as a pleasant, lightweight emacs. + +The build process for the example editor (supposedly called Zemacs, although the binary it renders is named zile) is the standard [Autotools][14] procedure: + + +``` +$ ./configure +$ make +``` + +#### Size + +Compiling it from source takes me a minute on one core or about 50 seconds on six cores (the configuration process is the long part). The binary produced in the end is 1.2MB, making this the heaviest of the lightweight emacsen I use, but compared to even GNU Emacs without X (which is 14MB on my system), it's relatively trivial. + +Of the lightweight emacsen I use, it's also the most complex. You can exclude some library links by disabling features during configuration, but here are the defaults: + + +``` +$ ldd src/zile +linux-vdso.so.1 +libacl.so.1 => /lib64/libacl.so.1 +libncurses.so.5 => /lib64/libncurses.so.5 +libgc.so.1 => /usr/lib64/libgc.so.1 +libc.so.6 => /lib64/libc.so.6 +libattr.so.1 => /lib64/libattr.so.1 +libdl.so.2 => /lib64/libdl.so.2 +libpthread.so.0 => /lib64/libpthread.so.0 +/lib64/ld-linux-x86-64.so.2 +``` + +#### Features + +Zile acts a little more like GNU Emacs than µemacs or Jove, but it's still a minimal experience. But some little touches are refreshing: Tab completion happens in a buffer, you can run shell commands from the mini-buffer, and you have a good assortment of functions available. It's by no means a GNU Emacs replacement, though, and if you wander too far in search of advanced features, you'll find out why it's only 1.2MB. + +I've been unable to find in-application help files, and the man page bundled with it is minimal. However, if you're comfortable with Emacs, Zile is a good compromise between the full 14MB (or greater, if you're using a GUI) version and the extremely lightweight implementations. + +### Jove + +![Jove][15] + +[Jove][16] was my first tiny emacs and remains the smallest I've found yet. This was an easy discovery for me, as it ships with [Slackware][17] Linux and, with a surreptitious symlink, quickly became my personal replacement for the Vi binary. Jove is based on GNU Emacs, but the man page cautions that feature parity is by no means to be expected. I find Jove surprisingly feature-rich for such a small binary (in fact, this article was written in Jove version 4.17.06-9), but there's no question that renaming .emacs to .joverc does _not_ behave as you might hope. + +#### Size + +It takes me five seconds to compile Jove at the slowest setting (-j1) and about a second using all cores. The resulting binary, confusingly called jjove by default, is just 293KB. + +The Jove binary is independent enough to run on most Linux boxes: + + +``` +$ ldd jjove +linux-vdso.so.1 +libtermcap.so.2 => /lib64/libtermcap.so.2 +libc.so.6 => /lib64/libc.so.6 +/lib64/ld-linux-x86-64.so.2 +``` + +#### Features + +Jove has good documentation in the form of a man page. You can also get a helpful listing of all available commands by typing **M-x ?** and using the Spacebar to scroll. If you're entirely new to emacs, you can run **teachjove** to learn Jove (and emacs, accordingly). + +Most common editing commands and keybindings work as expected. Some oddities exist; for example, there's no vertical split, and Tab completion for paths in the mini-buffer is non-existent. However, it's the smallest emacs I've found and yet has a full GNU Emacs feel to it. + +### Try Emacs + +If you've only ever tried GNU Emacs, then you might find that the world of emacsen is richer than you may have expected. There's a rich tradition behind emacs, and trying some of its variants, spin-offs, and alternate implementations is part of the joy of being comfortable with how emacsen work. Get to know emacs; carry a few builds around everywhere you go, and you'll never have to use a substandard editor again! + +GNU Emacs can be much more than just a text editor. Learn how to get started. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/lightweight-emacs + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://www.gnu.org/software/emacs/ +[3]: https://www.nano-editor.org/ +[4]: https://opensource.com/article/19/3/getting-started-vim +[5]: https://www.emacswiki.org/emacs/Emacsen +[6]: https://opensource.com/article/20/2/who-cares-about-emacs +[7]: https://opensource.com/sites/default/files/uploads/lightweight-emacs-uemacs.jpg (µemacs) +[8]: https://en.wikipedia.org/wiki/MicroEMACS +[9]: https://git.kernel.org/pub/scm/editors/uemacs/uemacs.git +[10]: https://opensource.com/tags/linux +[11]: https://opensource.com/downloads/emacs-cheat-sheet +[12]: https://opensource.com/sites/default/files/uploads/lightweight-emacs-zile.jpg (GNU Zile) +[13]: https://www.gnu.org/software/zile/ +[14]: https://opensource.com/article/19/7/introduction-gnu-autotools +[15]: https://opensource.com/sites/default/files/uploads/lightweight-emacs-jove.jpg (Jove) +[16]: https://opensource.com/article/17/1/jove-lightweight-alternative-vim +[17]: http://slackware.com From 842af9ddb8e9532d7505601d567d34a0f68d7400 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Mar 2020 01:07:23 +0800 Subject: [PATCH 187/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200303=20How=20?= =?UTF-8?q?to=20assess=20your=20organization's=20technological=20maturity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200303 How to assess your organization-s technological maturity.md --- ...r organization-s technological maturity.md | 173 ++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 sources/tech/20200303 How to assess your organization-s technological maturity.md diff --git a/sources/tech/20200303 How to assess your organization-s technological maturity.md b/sources/tech/20200303 How to assess your organization-s technological maturity.md new file mode 100644 index 0000000000..75c3cda6ff --- /dev/null +++ b/sources/tech/20200303 How to assess your organization-s technological maturity.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to assess your organization's technological maturity) +[#]: via: (https://opensource.com/open-organization/20/3/communication-technology-worksheet) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +How to assess your organization's technological maturity +====== +Implementing new communications technologies can make your organization +more open. Use this worksheet to determine whether your organization—and +its people—are prepared. +![Someone wearing a hardhat and carrying code ][1] + +New communication technologies can promote and improve [open organizational principles and practices][2]—both within a company and between customers and strategic partners, leading to greater sales and business opportunities. + +Previously, I've discussed how companies adopting new communication technologies tend to [fall into four basic categories][3] of investment and utilization. In this article, I'll demonstrate how someone might assess an organization's level of preparedness for technological innovations and the cultural changes it requires. + +### Becoming a superstar + +For the purpose of this exercise, imagine you're a salesperson working for a company that provides communication or information technology solutions to companies that need advanced information systems and would benefit by becoming "[communication superstars][3]." You'll likely want to impress upon your customers the benefits of becoming this type of user—benefits such as: + + * Enhanced customer interaction: When _our_ customers' salespeople visit _their_ customers, they'll need to make the best impression they can to build some level of trust. Therefore—before offering any product—a salesperson must get a customer talking about his situation in order to discover his particular needs, concerns, and opportunities for growth. When the customer asks the salesperson questions about what he can do to address these issues, imagine our customer's salespeople being able to answer him in seconds with detailed information, instead of making the customer wait for hours, day, or even weeks for the answers. Such technologies can increase one's capacity to make proposals, lead to faster and wiser purchasing decisions, and maximize salesperson-customer interactions—all extremely important benefits. + * Better operations: In manufacturing especially, production bottlenecks can be a drain on in-process inventory costs, and alleviating those bottlenecks is critical. Knowing _exactly_ the situation (in-process inventory levels and processing speed, for example) of _every_ stage of a production line in real time can greatly [improve productivity][4]. + * Development of new business strategies: With new communication technology expertise, a company could open up new markets and opportunities that would have historically been out of its reach. + + + +### **Let's do some research** + +Armed with knowledge of those benefits, again imagine you're a salesperson at an enterprise communication or information technology company. You meet a potential customer at an exhibition or business summit, and she describes the following situation to you: + +> "I'm the Operations Manager of a small, local transportation company that makes deliveries within and between several of the surrounding cities. We have a fleet of 30 trucks, all of various sizes and makes. I know the company's information system must to be improved; much of our communication is done through email attachments, texting, and mobile phone calls. We have no central information operating system." + +A large, public, national trucking company has set up in her area. She's studied this competitor and read several of its news releases and annual reports. She's learned the company has a centralized communications system, and that all its trucks have tracking technologies that monitor the location of every truck in operation. Trucks also feature sensors that monitor many vehicle operations, including average and specific engine RPM per route by vehicle and driver, and miles travelled in particular conditions (to determine fuel economy and maintenance schedules). An electronic parts delivery system connects this company's service operations with a network of dealers to reduce the time service technicians must wait for parts. + +This is what the small local trucking company must compete against. So its operations manager asks you, the IT company salesperson, what you can do to help. + +You decide that your first step is to conduct a survey to learn more about both the company's current communication technology system and the personnel's attitude toward this system in order to see what _could_ and _should_ be done to improve the situation. While there, you want to learn this trucking company's IT status _before_ making any recommendations. + +I've created a worksheet you might use to facilitate this conversation. + +### Taking the temperature + +The first part of the worksheet can help you develop a baseline assessment of an organization's readiness for technological change. + +#### Part 1: Baseline maturity relative to competitors + +Generally, if the customer scores between 10 and 42, then that customer needs more assistance adopting new communication technology, but this varies by industry. If the score is between 43 and 70, then (when compared to competitors the customer is likely already mature in its use of communication technologies. + +#### Part 2: Leaders' relationship to communication technologies + +Next, you need to assess the company leadership's relationship to technologies, associated processes, and cultural changes. So let's make those calculations in Part 2 of the worksheet. + +Here again, depending on the competitive environment, if the score is between 10 and 42, then the company is generally _not_ completely utilizing the communication technology it has. If the score is between 43 and 70, then generally the company puts the communication technology it has to good, creative use. + +Organizational leaders must lead the conversation about using more advanced communication systems in the organization. Therefore management must establish training programs to teach everyone in the organization the skills required to _use_ that technology (a step often forgotten or poorly implemented). + +#### Part 3: Awareness of challenges and opportunities + +We now need to help the organization think more strategically about its use of communication technologies to implement open processes and open culture. We'll do this with Part 3 of the worksheet. + +If an organization scores higher than 15, the company understands the communication technology landscape fairly well. If the score is between 9 and 15, the organization needs to isolate its weakest areas and remedy them. A score of less than 9 indicates that the organization should consider conducting new awareness exercises and/or communication technology discovery programs. + +#### Part 4: Technological mastery relative to competitors + +Next, we need to better understand the trucking company's current strategic assets and its level of technological mastery relative to competitors. We'll do that with Part 4 of the worksheet. + +An organization that scores above 16 in this section likely knows where it stands and what its innovation trajectory is in comparison to competitors. A score of 7 to 16 means the organization needs to build alignment around a viable renewal path. A score of less than 7 might mean the organization should conduct a communication technology maturity assessment and update its best practices. + +#### Part 5: Ability to articulate technological vision + +Now let's explore how well the organization's senior leaders can articulate a vision for the role communication technology will play in the company's future. That's Part 5 of the worksheet. + +If the organization scores over 24, then its members likely believe its executives are aligned on a technological vision (and are considering competitors). A score of 14 to 24 should prompt us to isolate the root causes of the concerns and work with the team to remedy them. Anything less than 14 should spur a structured senior executive alignment initiative. + +Questions like these can clarify the extent to which employees must be involved in communication technology investment decision-making and utilization. Front-line members typically know what's necessary, what's available, and what the organization should introduce. + +### From vision to action + +I've seen first-hand that in situations like these, purchasing technologies is only half the problem. Getting people to buy into the system and use it to full capacity are far bigger challenges. + +In this section, we'll assess the organization's ability to translate technological vision into action. + +#### Part 6: Ability to translate vision to action + +First, let's see how the company is currently converting its vision into an action plan relative to competitors. We'll return to the worksheet, specifically Part 6. + +A company scoring more than 17 points likely has a robust plan and evaluation system in place, and is focused on engaging people in executing technological adoption efforts relative to competitors. Organizations scoring 7 to 17 should review the action plan and milestone checklist weekly for content and alignment. Those scoring less than 7 should conduct a full review of its milestone checklist and action plan processes. + +#### Part 7: Supervision strategies + +Few plans succeed without proper supervision, so you'll want to assess the organization's plans to oversee change management efforts. We'll use the trusty worksheet—this time, Part 7. + +Did the company score something greater than 15? Then its supervision model is in good shape. Maybe 8 to 15? It should check its governance principles and/or program leadership. Less than 8? Time to rework (or design for the first time) its supervision principles. + +#### Part 8: Funding strategy for implementation + +Of course, organizational initiatives like these require funding. So you'll want to assess the organization's financial commitment to technological change. Once again, let's use our worksheet (Part 8 this time). + +Scoring more than 16 points means the company's funding for new communication technologies is strong. Scoring 8 to 16 means the company should work to ensure that the company portfolio, funding, and business strategy are better aligned. Anything less than 8 means company needs to rework its investment and funding strategy for new technologies. + +#### Part 9: Clarity and promotion of vision + +Organizational leaders should constantly be clarifying and advocating plans to adopt new technologies. How are they doing? Let's review Part 9 of our worksheet. + +If the company scores over 17, then it's likely doing a good job of marketing its ambitions. If it scores somewhere between 7 and 17, it should isolate dimensions of its messaging that need refinement and work with the team to remedy them. If it scores less than 7, it should consider developing a specific program to convey the company's ambition more broadly. + +#### Part 10: Ability to build and sustain engagement + +Changes to technological systems and processes don't happen automatically. People need to invest in them, and leaders need to sustain their engagement in the organizational changes. Not everyone will buy in (as I've [written previously][5]). We can assess how well the organization is doing this with Part 10 of the worksheet. + +A score over 23 indicates that the company is doing a good job building momentum while introducing communication technologies. A score of 12 to 23 means that organization might need to isolate some part of the process that's not proceeding satisfactorily and remedy that component. Less than 12? The company needs to design and conduct a full engagement program. + +### Organizational considerations + +This final section assesses specific _organizational_ capacities—that is, the organization's culture, its structure, and its processes. Becoming more open by adopting new communication technologies is only possible if the organization itself is flexible and willing to change. + +#### Part 11: Organizational culture + +Is the organizational environment amenable to the kinds of changes necessary for effectively adopting new communication activities? We'll assess that in Part 11 of our worksheet. + +An organization scoring more than 16 points is already shifting its organizational behaviors and culture ahead of competitors. One scoring between 7 and 16 points should investigate root causes of concerns about cultural changes and work with the team to remedy problems. An organization scoring less than 7 should begin working to shift its culture around communication practices and expectations. + +#### Part 12: Organizational structure + +Does the organization's current structure allow it to sustain communication technology innovations? Use Part 12 of the worksheet to gather an initial impression. + +Scoring over 16 means the company possesses the basic structural capabilities necessary for sustained, steady, technical changes. Scoring between 8 and 16 means the company has only begun implementing projects aimed at developing necessary structural capabilities, but more effort is needed. And a score of less than 8 indicates that the company needs to consider specific programs for improving basic structural capabilities. + +#### Part 13: Reward and incentive structures + +Are the organization's reward and incentive structures aligned with the organization's goals for introducing and adopting new communication technologies? Let's look at the worksheet one last time. + +A score over 14 indicates that the company's current reward structures are aligned with its communication technology objectives. A score between 6 and 14 tells us that the organization should build stronger consensus around a viable reward strategy aligned to communication technology renewal. And a score of less than 6 should prompt leadership to implement specific reward structures that accomplish its communication technology adoption goals. + +### Post-survey debrief + +After collecting those data, you're now in a position to ask how your information technology company can help your potential customer in four areas: + + 1. Data gathering and company strategy analytics + 2. Social media, internet utilization, and interaction internally + 3. Telecommunication utilization within company (to avoid excess and unnecessary traveling for meetings, etc.) + 4. Automation technology utilization within the company + + + +You're also able to inquire within your company (among solution architects, for example) who we potentially should partner with if need be in order to achieve this transportation company's goals in these four areas." + +In these kinds of strategic partnerships, open organization principles—especially transparency, inclusivity, collaboration, and community—come alive. One person cannot do this kind of work alone. + +I've seen first-hand that in situations like these, purchasing technologies is only _half the problem._ Getting people to _buy into the system_ and _use it to full capacity_ are far bigger challenges. These challenges are cultural, not technological. Being a "communication superstar" means being great in both those areas—both the communication technology itself, as well as the culture and process expertise necesasry for actual utilization. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/3/communication-technology-worksheet + +作者:[Ron McFarland][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/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/build_structure_tech_program_code_construction.png?itok=nVsiLuag (Someone wearing a hardhat and carrying code ) +[2]: https://opensource.com/open-organization/resources/open-org-definition +[3]: https://opensource.com/open-organization/20/1/communication-technology-superstars +[4]: https://www.slideshare.net/RonMcFarland1/improving-processes-65115172?qid=b0a0fde3-62c6-4538-88c8-1bfd70485cee&v=&b=&from_search=5 +[5]: https://opensource.com/open-organization/17/1/escape-the-cave From d2f3f6dbad41ec895c0b5b33c95ceeac8aba8717 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Mar 2020 01:09:06 +0800 Subject: [PATCH 188/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200303=20Key=20?= =?UTF-8?q?Takeaways=20from=20Cisco=E2=80=99s=20Annual=20Internet=20Report?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200303 Key Takeaways from Cisco-s Annual Internet Report.md --- ...ays from Cisco-s Annual Internet Report.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/talk/20200303 Key Takeaways from Cisco-s Annual Internet Report.md diff --git a/sources/talk/20200303 Key Takeaways from Cisco-s Annual Internet Report.md b/sources/talk/20200303 Key Takeaways from Cisco-s Annual Internet Report.md new file mode 100644 index 0000000000..d450597913 --- /dev/null +++ b/sources/talk/20200303 Key Takeaways from Cisco-s Annual Internet Report.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Key Takeaways from Cisco’s Annual Internet Report) +[#]: via: (https://www.networkworld.com/article/3529989/key-takeaways-from-cisco-s-annual-internet-report.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Key Takeaways from Cisco’s Annual Internet Report +====== +Businesses need to be ready for the massive wave of devices and bandwidth that are coming in the next vide years +Natalya Burova / Getty Images + +By 2023, two-thirds of the world’s population will have Internet access—that’s 5.3 billion total Internet users, compared to 3.9 billion in 2018. The number of devices and connections will also skyrocket. There will be 3.6 networked devices per capita by 2023, whereas in 2018, there were 2.4 networked devices per capita. + +These findings come from Cisco’s _[Annual Internet Report (2018 – 2023) ][1]_(AIR) - previously known as Visual Network Index (VNI), which assesses the digital transformation across different business segments and their adoption of networking technologies, including fixed broadband, Wi-Fi, and mobile (3G, 4G, 5G).  + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +The report described an increased demand for new or enhanced applications that boost workforce productivity or improve customer experiences. In today’s mobile world, users expect their devices (and networks) to deliver on all fronts: quality, ease of use, and seamless connectivity.  + +[Cisco][3] + +The report can be useful as companies plan out their network strategies. One of the aspects of the VNI that Cisco carried over to AIR is an [online tool][4] that lets people slice and dice the information by country, device or other factors. They also included an [“Internet readiness” tool ][5]that explores how prepared different regions are for the coming wave of devices and need for bandwidth.  + +**More network automation is needed** + +To meet growing demand for enhanced apps, enterprises need automated network monitoring and optimization, andt that can be achieved with software-defined wide area networking (SD-WAN). Software-driven networks create more flexible infrastructures that can adapt to changing traffic requirements, which becomes necessary as more enterprises move to hybrid clouds, the report says. + +Policy-based automation and Intent-Based Networking (IBN) are just as important when it comes to building agile, portable, and scalable networks. IBN, as the name implies, captures business intent through analytics and machine learning. One trend Cisco observed in its report is how business WAN traffic flow patterns are becoming more software-based and hybrid in nature, creating a need for IBN solutions, the report says. + +[][6] + +**SD-WAN is core to network success** + +SD-WAN is important to the network edge, which brings computing, storage, and networking resources closer to users and devices. Cisco found many use cases driving the need for greater edge-computing capabilities. One of them is finding ways to control data from the billions of Internet of Things (IoT) endpoints being added to the network edge. + +Out of the 29.3 billion networked devices in use by 2023, about half will support various IoT applications, per Cisco’s report. As for machine-to-machine (M2M) communication, there will be 14.7 billion connections by 2023. Consumers will hold the biggest share (74%) of total devices and connections, with businesses claiming approximately 26%. However, the consumer share will grow at a slower rate than business. + +How will enterprises manage to secure all networked devices and data? Cisco recommends creating a security policy that strikes a balance between data protection and ease of use. In other words, networks will have to be intelligent enough to grant access to the right users without putting them through a difficult authentication process. + +**Network managers still struggle to lower operational costs** + +Network managers continue to struggle with rising operational costs, as the explosion of devices and data outpaces IT resources. Cisco found nearly 95% of network changes are still performed manually, resulting in operational costs that outweigh network costs. That’s where IT automation can help, enabled by SDN, intelligent network-edge enhancements, and unified domain controls. + +In addition to exploring business-specific networking needs, Cisco outlined some trends in consumer and small-to-medium business (SMB) markets. Here are the key takeaways: + + * **Next-generation applications**—built with artificial intelligence (AI) and machine learning—will create complex requirements and new business models. Mobile applications, specifically, will drive future consumer, SMB, and enterprise needs, with 299.1 billion mobile apps downloaded worldwide by 2023. + * **Mixed devices and connections** are enabling myriad M2M apps. Connected-home, video-surveillance, connected appliances, and tracking apps will make up 48% of M2M connections by 2023. Connected-car apps will be the fastest-growing category, with connected cities coming in second. + * **Accelerating broadband speeds** will affect traffic growth and use of high-bandwidth content and applications. Average broadband speeds will more than double globally from 45.9 Mbps (in 2018) to 110.4 Mbps (in 2023). Fiber-to-the-home (FTTH), high-speed DSL, and cable broadband adoption will contribute to the growth. + * **Wi-Fi will gain momentum** as devices and IoT connections increase. By 2023, the number of public Wi-Fi hotspots will grow to 628 million, up from 169 million in 2018. Wi-Fi 6 promises to boost speeds by up to 30%, compared to the current generation. More importantly, next-gen Wi-Fi will significantly improve real-time communications and high-definition video, impacting both consumer and business sectors. + + + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3529989/key-takeaways-from-cisco-s-annual-internet-report.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: http://www.cisco.com/go/ciscoair +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.cisco.com/c/en/us/solutions/collateral/executive-perspectives/annual-internet-report/white-paper-c11-741490.html +[4]: https://www.cisco.com/c/en/us/solutions/executive-perspectives/annual-internet-report/air-highlights.html +[5]: https://www.cisco.com/c/en/us/solutions/service-provider/cloud-readiness-tool/index.html +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From 77330e72f751d0dea17086412d79458ed8735ab5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Mar 2020 01:18:38 +0800 Subject: [PATCH 189/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200303=20Watchi?= =?UTF-8?q?ng=20activity=20on=20Linux=20with=20watch=20and=20tail=20comman?= =?UTF-8?q?ds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200303 Watching activity on Linux with watch and tail commands.md --- ...y on Linux with watch and tail commands.md | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 sources/tech/20200303 Watching activity on Linux with watch and tail commands.md diff --git a/sources/tech/20200303 Watching activity on Linux with watch and tail commands.md b/sources/tech/20200303 Watching activity on Linux with watch and tail commands.md new file mode 100644 index 0000000000..15780a5b34 --- /dev/null +++ b/sources/tech/20200303 Watching activity on Linux with watch and tail commands.md @@ -0,0 +1,148 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Watching activity on Linux with watch and tail commands) +[#]: via: (https://www.networkworld.com/article/3529891/watching-activity-on-linux-with-watch-and-tail-commands.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Watching activity on Linux with watch and tail commands +====== +The watch and tail commands can help monitor activity on Linux systems. This post looks at some helpful ways to use these commands. +Loops7 / Getty Images + +The **watch** and **tail** commands provide some interesting options for examining activity on a Linux system in an ongoing manner. + +That is, instead of just asking a question and getting an answer (like asking **who** and getting a list of currently logged in users), you can get **watch** to provide you with a display showing who is logged in along with updates as users come and go. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +With **tail**, you can display the bottoms of files and see content as it is added. This kind of monitoring is often very helpful and requires less effort than running commands periodically. + +### Using watch + +One of the simplest examples of using **watch** is to use the command **watch who**. You should see a list showing who is logged in along with when they logged in and where they logged in from. Notice that the default is to update the display every two seconds (top left) and that the date and time (upper right) updates itself at that interval. The list of users will grow and shrink as users log in and out. + +### $ watch who + +This command will dissplay a list of logins like this: + +``` +Every 2.0s: who dragonfly: Thu Feb 27 10:52:00 2020 + +nemo pts/0 2020-02-27 08:07 (192.168.0.11) +shs pts/1 2020-02-27 10:58 (192.168.0.5) +``` + +You can change the interval to get less frequent updates by adding a **-n** option (e.g., -n 10) to select a different number of seconds between updates. + +### $ watch -n 10 who + +The new interval will be displayed and the time shown will change less frequently, aligning itself with the selected interval. + +[][2] + +``` +Every 10.0s: who dragonfly: Thu Feb 27 11:05:47 2020 + +nemo pts/0 2020-02-27 08:07 (192.168.0.11) +shs pts/1 2020-02-27 10:58 (192.168.0.5) +``` + +If you prefer to see only the command's output and not the heading (the top 2 lines), you can omit those lines by adding the **-t** (no title) option. + +### $ watch -t who + +Your display will then look like this: + +``` +nemo pts/0 2020-02-27 08:07 (192.168.0.11) +shs pts/1 2020-02-27 10:58 (192.168.0.5) +``` + +If every time the watched command runs, its output is the same, only the title line (if not omitted) will change. The rest of the displayed information will stay the same. + +If you want your **watch** command to exit as soon as the output of the command that it is watching changes, you can use a **-g** (think of this as the "go away") option. You might choose to do this if, for example, you are simply waiting for others to start logging into the system. + +You can also highlight changes in the displayed output using the **-d** (differences) option. The highlighting will only last for one interval (2 seconds by default), but can help to draw your attention to the changes. + +Here's a more complex example of using the **watch** command to display services that are listening for connections and the ports they are using. While the output isn't likely to change, it would alert you to any new service starting up or one going down. + +``` +$ watch 'sudo lsof -i -P -n | grep LISTEN' +``` + +Notice that the command being run needs to be enclosed in quotes to ensure that the **watch** command doesn't send its output to the grep command. + +Using the **watch -h** command will provide you with a list of the command's options. + +``` +$ watch -h + +Usage: + watch [options] command + +Options: + -b, --beep beep if command has a non-zero exit + -c, --color interpret ANSI color and style sequences + -d, --differences[=] + highlight changes between updates + -e, --errexit exit if command has a non-zero exit + -g, --chgexit exit when output from command changes + -n, --interval seconds to wait between updates + -p, --precise attempt run command in precise intervals + -t, --no-title turn off header + -x, --exec pass command to exec instead of "sh -c" + + -h, --help display this help and exit + -v, --version output version information and exit +``` + +### Using tail -f + +The **tail -f** command has something in common with **watch**. It will both display the bottom of a file and additional content as it is added. Instead of having to run a "tail" command again and again, you run one command and get a repeatedly updated view of its output. For example, you could watch a system log with a command like this: + +``` +$ tail -f /var/log/syslog +``` + +Some files, like **/var/log/wtmp**, don't lend themselves to this type of handling because they're not formatted as normal text files, but you could get a similar result by combining **watch** and **tail** like this: + +``` +watch 'who /var/log/wtmp | tail -20' +``` + +This command will display the most recent 5 logins regardless of how many of the users are still logged in. If another login occurs, a line will be added and the top line removed. + +``` +Every 60.0s: who /var/log/wtmp | tail -5 dragonfly: Thu Feb 27 12:46:07 2020 + +shs pts/0 2020-02-27 08:07 (192.168.0.5) +nemo pts/1 2020-02-27 08:26 (192.168.0.5) +shs pts/1 2020-02-27 10:58 (192.168.0.5) +nemo pts/1 2020-02-27 11:34 (192.168.0.5) +dory pts/1 2020-02-27 12:14 (192.168.0.5) +``` + +Both the **watch** and **tail -f** commands can provide auto-updating views of information that you might at times want to monitor, making the task of monitoring quite a bit easier whether you're monitoring processes, logins or system resources. + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3529891/watching-activity-on-linux-with-watch-and-tail-commands.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/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From 206f0206d03b3c49f013fc44b2ac4ba5da0b8658 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Tue, 3 Mar 2020 22:10:19 +0100 Subject: [PATCH 190/260] Update 20200225 3 eBook readers for the Linux desktop.md --- sources/tech/20200225 3 eBook readers for the Linux desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200225 3 eBook readers for the Linux desktop.md b/sources/tech/20200225 3 eBook readers for the Linux desktop.md index 1c057a15ed..0fea0ba883 100644 --- a/sources/tech/20200225 3 eBook readers for the Linux desktop.md +++ b/sources/tech/20200225 3 eBook readers for the Linux desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wenwensnow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b08890fe07482b838c8c9cb8bab5b763936598c6 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Tue, 3 Mar 2020 22:37:35 +0100 Subject: [PATCH 191/260] Update 20200225 3 eBook readers for the Linux desktop.md --- .../tech/20200225 3 eBook readers for the Linux desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200225 3 eBook readers for the Linux desktop.md b/sources/tech/20200225 3 eBook readers for the Linux desktop.md index 0fea0ba883..700f56aeed 100644 --- a/sources/tech/20200225 3 eBook readers for the Linux desktop.md +++ b/sources/tech/20200225 3 eBook readers for the Linux desktop.md @@ -7,10 +7,10 @@ [#]: via: (https://opensource.com/article/20/2/linux-ebook-readers) [#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) -3 eBook readers for the Linux desktop +3 eBook readers for the Linux desktop 针对Linux桌面版的3个电子书阅读器 ====== Any of these open source eBook applications will make it easy to read -your books on a larger screen. +your books on a larger screen. 任意一个开源电子书应用都能使你在更大屏幕上的阅读体验得到提升。 ![Computer browser with books on the screen][1] I usually read eBooks on my phone or with my Kobo eReader. I've never been comfortable reading books on larger screens. However, many people regularly read books on their laptops or desktops. If you are one of them (or think you might be), I'd like to introduce you to three eBook readers for the Linux desktop. From 0e966feb51d1ddfa043b7ee320479b4a3b808489 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 4 Mar 2020 08:23:12 +0800 Subject: [PATCH 192/260] translated --- ...se logzero for simple logging in Python.md | 156 ------------------ ...se logzero for simple logging in Python.md | 155 +++++++++++++++++ 2 files changed, 155 insertions(+), 156 deletions(-) delete mode 100644 sources/tech/20200226 Use logzero for simple logging in Python.md create mode 100644 translated/tech/20200226 Use logzero for simple logging in Python.md diff --git a/sources/tech/20200226 Use logzero for simple logging in Python.md b/sources/tech/20200226 Use logzero for simple logging in Python.md deleted file mode 100644 index 467b30d968..0000000000 --- a/sources/tech/20200226 Use logzero for simple logging in Python.md +++ /dev/null @@ -1,156 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use logzero for simple logging in Python) -[#]: via: (https://opensource.com/article/20/2/logzero-python) -[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) - -Use logzero for simple logging in Python -====== -A quick primer on the handy log library that can help you master this -important programming concept. -![Snake charmer cartoon with a yellow snake and a blue snake][1] - -The logzero library makes logging as easy as a print statement, which is quite a feat of simplicity. I'm not sure whether logzero took its name to fit in with the series of "zero boilerplate" libraries like pygame-zero, GPIO Zero, and guizero, but it's certainly in that category. It's a Python library that makes logging straightforward. - -You can just use its basic logging to stdout the same way you might use print for information and debugging purposes, and it has a smooth learning curve towards more advanced logging, like logging to a file. - -To start, install logzero with pip: - - -``` -`$ sudo pip3 install logzero` -``` - -Now in a Python file, import logger and try one or all of these logging examples: - - -``` -from logzero import logger - -logger.debug("hello") -logger.info("info") -logger.warning("warning") -logger.error("error") -``` - -The output is automatically colored in an easy-to-read way: - -![Python, Raspberry Pi: import logger][2] - -So now, instead of using **print** to figure out what's going on, use logger instead, with the relevant log level. - -### Writing logs to a file in Python - -If you only read this far and make that one change in the way you write code, that's good enough for me. If you want to go further, read on! - -Writing to **stdout** is fun for testing a new program, but it is only useful if you are logged into the computer where the script is running. Many times when using an application you'll want to execute the code remotely and review errors after the fact. That's when it's helpful to log to a file instead. Let's try it: - - -``` -from logzero import logger, logfile - -logfile('/home/pi/test.log') -``` - -Now your log entries will be logged into the file **test.log**. Remember to make sure that the [script has permission][3] to write to that file and its directory structure. - -You can specify some more options too: - - -``` -`logfile(’/home/pi/test.log’, maxBytes=1e6, backupCount=3)` -``` - -Now when the file provided to **logfile** reaches 1MB (1×106 bytes), it will rotate entries through **test.log.1**, **test.log.2**, and so on. This behavior is nice to avoid generating a massive log file that is I/O intensive for the system to open and close. You might also want to log to **/var/log** like a pro. Assuming you're on Linux, you a directory and make your user the owner so they can write to it: - - -``` -$ sudo mkdir /var/log/test -$ sudo chown pi /var/log/test -``` - -Then in your Python code, change the **logfile** path: - - -``` -`logfile(’/var/log/test/test.log’, maxBytes=1e6, backupCount=3)` -``` - -When it comes to catching exceptions in your **logfile**, you can either use **logging.exception:** - - -``` -try: -    c = a / b -except Exception as e: -    logger.exception(e) -``` - -This will produce the following (in the case that b is zero): - - -``` -[E 190422 23:41:59 test:9] division by zero -     Traceback (most recent call last): -       File "test.py", line 7, in -         c = a / b -     ZeroDivisionError: division by zero -``` - -You get the log entry, followed by the full traceback. Alternatively, you could use **logging.error** and hide the traceback: - - -``` -try: -    c = a / b -except Exception as e: -    logger.error(f"{e.__class__.__name__}: {e}") -``` - -Now this will produce the more succinct: - - -``` -`[E 190423 00:04:16 test:9] ZeroDivisionError: division by zero` -``` - -* * * - -* * * - -* * * - -**![Logging output][4]** - -There are plenty more options which you can read in the docs at [logzero.readthedocs.io][5]. - -### logzero shines for education - -Logging can be a challenging concept for a new programmer. Most frameworks depend on flow control and lots of variable manipulation to make a meaningful log, but logzero is different. With its syntax being similar to a print statement, it is a big win for education as it saves from explaining another concept. Give it a try on your next project. - -\-- - -_This article was originally written on [my blog][6] and is republished with permission._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/logzero-python - -作者:[Ben Nuttall][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/bennuttall -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake) -[2]: https://opensource.com/sites/default/files/uploads/rpi_ben_1.png (Python, Raspberry Pi: import logger) -[3]: https://opensource.com/article/19/6/understanding-linux-permissions -[4]: https://opensource.com/sites/default/files/uploads/rpi_ben_2.png (Logging output) -[5]: https://logzero.readthedocs.io/en/latest/ -[6]: https://tooling.bennuttall.com/logzero/ diff --git a/translated/tech/20200226 Use logzero for simple logging in Python.md b/translated/tech/20200226 Use logzero for simple logging in Python.md new file mode 100644 index 0000000000..f246475da4 --- /dev/null +++ b/translated/tech/20200226 Use logzero for simple logging in Python.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use logzero for simple logging in Python) +[#]: via: (https://opensource.com/article/20/2/logzero-python) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +使用 logzero 在 Python 中进行简单日志记录 +====== +一个方便的日志库快速入门,来帮助你掌握这个重要的编程概念。 +![Snake charmer cartoon with a yellow snake and a blue snake][1] + +logzero 库使日志记录就像打印语句一样容易,是简单性的杰出代表。我不确定 logzero 的名称是否要与 pygame-zero、GPIO Zero 和 guizero 这样的 “zero 样板库”契合,但是肯定属于该类别。它是一个 Python 库,使得日志记录变得简单明了。 + +你可以使用它的基本日志记录到标准输出,就像你可以使用 print 来获得信息和调试一样,它还有学习更高级日志记录(例如记录到文件)的平滑学习曲线。 + +首先,使用 pip 安装 logzero: + + +``` +`$ sudo pip3 install logzero` +``` + +在 Python 文件中,导入 logger 并尝试以下一个或所有日志实例: + + +``` +from logzero import logger + +logger.debug("hello") +logger.info("info") +logger.warning("warning") +logger.error("error") +``` + +输出以易于阅读的方式自动着色: + +![Python, Raspberry Pi: import logger][2] + +因此现在不要再使用 **print** 来了解发生了什么,而应使用有相关日志级别的 logger。 + +### 在 Python 中将日志写入文件 + +如果你阅读至此,并会在你写代码时做一点改变,这对我就足够了。如果你要了解更多,请继续阅读! + +写到**标准输出**对于测试新程序不错,但是仅当你登录到运行脚本的计算机时才有用。在很多时候,你需要远程执行代码并在事后查看错误。这种情况下,记录到文件很有帮助。让我们尝试一下: + + +``` +from logzero import logger, logfile + +logfile('/home/pi/test.log') +``` + +现在,你的日志条目将记录到文件 **test.log** 中。记住确保[脚本有权限] [3]写入该文件及其目录结构。 + +你也可以指定更多选项: + + +``` +`logfile(’/home/pi/test.log’, maxBytes=1e6, backupCount=3)` +``` + +现在,当提供给 **logfile** 文件达到 1MB(10^6 字节)时,它将通过 **test.log.1**、**test.log.2** 等文件轮询写入。这种行为可以避免系统打开和关闭大量 I/O 密集的日志文件,以至于系统无法打开和关闭。你或许还要记录到 **/var/log**。假设你使用的是 Linux,那么创建一个目录并将用户设为所有者,以便可以写入该目录: + + +``` +$ sudo mkdir /var/log/test +$ sudo chown pi /var/log/test +``` + +然后在你的 Python 代码中,更改 **logfile** 路径: + + +``` +`logfile(’/var/log/test/test.log’, maxBytes=1e6, backupCount=3)` +``` + +当要在 **logfile** 中捕获异常时,可以使用 **logging.exception**:。 + + +``` +try: +    c = a / b +except Exception as e: +    logger.exception(e) +``` + +这将输出(在 b 为零的情况下): + + +``` +[E 190422 23:41:59 test:9] division by zero +     Traceback (most recent call last): +       File "test.py", line 7, in +         c = a / b +     ZeroDivisionError: division by zero +``` + +你会得到日志,还有完整回溯。另外,你可以使用 **logging.error** 并隐藏回溯: + + +``` +try: +    c = a / b +except Exception as e: +    logger.error(f"{e.__class__.__name__}: {e}") +``` + +现在,将产生更简洁的结果: + + +``` +`[E 190423 00:04:16 test:9] ZeroDivisionError: division by zero` +``` + +* * * + +* * * + +* * * + +**![Logging output][4]** + +你可以在 [logzero.readthedocs.io] [5] 中阅读更多选项。 + +### logzero 为教育而生 + +对于新手程序员来说,日志记录可能是一个具有挑战性的概念。大多数框架依赖于流控制和大量变量操作来生成有意义的日志,但是 logzero不同。由于它的语法类似于 print 语句,因此它在教育上很成功,因为它无需解释其他概念。在你的下个项目中试试它。 + +\-- + +_此文章最初发布在[我的博客] [6]上,经许可重新发布。_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/logzero-python + +作者:[Ben Nuttall][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/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake) +[2]: https://opensource.com/sites/default/files/uploads/rpi_ben_1.png (Python, Raspberry Pi: import logger) +[3]: https://opensource.com/article/19/6/understanding-linux-permissions +[4]: https://opensource.com/sites/default/files/uploads/rpi_ben_2.png (Logging output) +[5]: https://logzero.readthedocs.io/en/latest/ +[6]: https://tooling.bennuttall.com/logzero/ From cdbbfc8b788a0a5cc3c10c0ce2ee80429c6ba98b Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 4 Mar 2020 08:29:03 +0800 Subject: [PATCH 193/260] translating --- sources/tech/20200302 Install GNU Emacs on Windows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200302 Install GNU Emacs on Windows.md b/sources/tech/20200302 Install GNU Emacs on Windows.md index be429efe50..7ba0e633bb 100644 --- a/sources/tech/20200302 Install GNU Emacs on Windows.md +++ b/sources/tech/20200302 Install GNU Emacs on Windows.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 37a895dd36c454f99aa53ccea3a23711b896acbc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 4 Mar 2020 09:37:37 +0800 Subject: [PATCH 194/260] Rename sources/tech/20200303 Most-used libraries, open source adoption, and more industry trends.md to sources/talk/20200303 Most-used libraries, open source adoption, and more industry trends.md --- ...d libraries, open source adoption, and more industry trends.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200303 Most-used libraries, open source adoption, and more industry trends.md (100%) diff --git a/sources/tech/20200303 Most-used libraries, open source adoption, and more industry trends.md b/sources/talk/20200303 Most-used libraries, open source adoption, and more industry trends.md similarity index 100% rename from sources/tech/20200303 Most-used libraries, open source adoption, and more industry trends.md rename to sources/talk/20200303 Most-used libraries, open source adoption, and more industry trends.md From eacc073cf1bd6976e46e6faffe94c6aa3afdf846 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 4 Mar 2020 09:44:16 +0800 Subject: [PATCH 195/260] Rename sources/tech/20200303 How to assess your organization-s technological maturity.md to sources/talk/20200303 How to assess your organization-s technological maturity.md --- ...03 How to assess your organization-s technological maturity.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200303 How to assess your organization-s technological maturity.md (100%) diff --git a/sources/tech/20200303 How to assess your organization-s technological maturity.md b/sources/talk/20200303 How to assess your organization-s technological maturity.md similarity index 100% rename from sources/tech/20200303 How to assess your organization-s technological maturity.md rename to sources/talk/20200303 How to assess your organization-s technological maturity.md From e7c8cdc4e89fc540edc7e80068e76f397660d4c5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Mar 2020 10:09:23 +0800 Subject: [PATCH 196/260] PRF @lujun9972 --- ... to get social and track your todo list.md | 64 +++++++++---------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/translated/tech/20200129 Use Emacs to get social and track your todo list.md b/translated/tech/20200129 Use Emacs to get social and track your todo list.md index fff71fcc19..88e21c0f94 100644 --- a/translated/tech/20200129 Use Emacs to get social and track your todo list.md +++ b/translated/tech/20200129 Use Emacs to get social and track your todo list.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use Emacs to get social and track your todo list) @@ -9,19 +9,20 @@ 使用 Emacs 进行社交并跟踪你的待办事项列表 ====== -访问 Twitter、Reddit、 交谈、电子邮件 、RSS 和你的待办事项列表,这是我们关于 2020 年使用开源提高效率的 20 个方法系列的第 19 个。 -![团队沟通、交谈 ][1] -去年,我给你们带来了 2019 年的 19 天新生产力工具。今年,我将采取一种不同的方法:建立一个新的环境,让你使用已用或未用的工具在新的一年里更有效率,。 +> 在 2020 年用开源实现更高生产力的二十种方式的第十九篇文章中,访问 Twitter、Reddit、 交谈、电子邮件 、RSS 和你的待办事项列表。 + +![](https://img.linux.net.cn/data/attachment/album/202003/04/100911lg2vrv92692b422y.jpg) + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 ### 使用 Emacs 做(几乎)所有的事情,第 2 部分 -[昨天 ][2],我谈到了如何在 Emacs 中读取电子邮件、访问电子邮件地址和显示日历。Emacs 功能繁多,你还可以将它用于 Twitter、 交谈、待办事项列表等等! +[昨天][2],我谈到了如何在 Emacs 中读取电子邮件、访问电子邮件地址和显示日历。Emacs 功能繁多,你还可以将它用于 Twitter、交谈、待办事项列表等等! -[在 Emacs 中处理所有事情 ][3] - -要完成所有这些,您需要安装一些 Emacs 包。和昨天一样,用 `Meta+x package-manager` 打开 Emacs 包管理器 (Meta 在大多数键盘上是 **Alt**,在 MacOS 上是 **Option**)。然后通过 **i** 选择以下带有的软件包,然后输入 **x** 进行安装: +![在 Emacs 中处理所有事情][3] +要完成所有这些,你需要安装一些 Emacs 包。和昨天一样,用 `Meta+x package-manager` 打开 Emacs 包管理器(Meta 键在大多数键盘上是 `Alt`,在 MacOS 上是 `Option`)。然后通过 `i` 选择以下带有的软件包,然后输入 `x` 进行安装: ``` nnreddit @@ -31,7 +32,6 @@ twittering-mode 安装之后,按下 `Ctrl+x ctrl+f` 打开 `~/.emacs.d/init.el`,并在 `(custom-set-variables` 行前加上: - ``` ;; Todo.txt (require 'todotxt) @@ -54,11 +54,11 @@ twittering-mode [Twittering-mode][5] 是 Twitter 最好的 Emacs 接口之一。它几乎支持 Twitter 的所有功能,并且键盘快捷键也易于使用。 -首先,输入 `Meta+x twit` 来启动 twitter-mode。它会提供一个 URL 并提示你启动浏览器来访问它,你登录该 URL 后就能获得授权令牌。将令牌复制并粘贴到 Emacs 中,您的 Twitter 时间线就会加载了。您可以使用**箭头**键滚动,使用 **Tab** 从一个项目移动到另一个项目,并按 **Enter** 访问光标所在的 URL。如果光标在用户名上,按 **Enter** 将在 web 浏览器中打开时间轴。如果你在一条 tweet 的文本上,按 **Enter** 将回复该 tweet。你可以用 **u** 创建一个新的 tweet,用 `Ctrl+c+Enter` 转发一些内容,然后用 **d** 发送一条直接消息——它打开的对话框中有关于如何发送、取消和缩短 url 的说明。 +首先,输入 `Meta+x twit` 来启动 twittering-mode。它会提供一个 URL 并提示你启动浏览器来访问它,你登录该 URL 后就能获得授权令牌。将令牌复制并粘贴到 Emacs 中,你的 Twitter 时间线就会加载了。你可以使用箭头键滚动,使用 `Tab` 从一个项目移动到另一个项目,并按回车访问光标所在的 URL。如果光标在用户名上,按回车将在 web 浏览器中打开时间轴。如果你在一条推文的文本上,按回车将回复该推文。你可以用 `u` 创建一个新的推文,用 `Ctrl+c+Enter` 转发一些内容,然后用 `d` 发送一条即时消息——它打开的对话框中有关于如何发送、取消和缩短 URL 的说明。 -按 **V** 会打开一个提示让你跳转到其他时间线。输入 **:mentions** 打开你的提及。输入 **:home** 打开你的主时间线,输入用户名将进入该用户的时间线。最后,按 **q** 会退出 twittering-mode 并关闭窗口。 +按 `V` 会打开一个提示让你跳转到其他时间线。输入 `:mentions` 打开你的提及。输入 `:home` 打开你的主时间线,输入用户名将进入该用户的时间线。最后,按 `q` 会退出 twittering-mode 并关闭窗口。 -twitter-mode 还有更多功能,我鼓励你阅读它 GitHub 页面上的[完整功能列表 ][6]。 +twitter-mode 还有更多功能,我鼓励你阅读它 GitHub 页面上的[完整功能列表][6]。 #### 在 Emacs 上使用 Todotxt.el 追踪你的待办事项 @@ -66,27 +66,27 @@ twitter-mode 还有更多功能,我鼓励你阅读它 GitHub 页面上的[完 [Todotxt.el][8] 是一个很棒的 [todo.txt][9] 待办列表管理器接口。它的快捷键几乎无所不包。 -输入 `Meta+x todotxt` 启动它将加载 **todotxt-file** 变量中指定的 todo.txt 文件(本文的第一部分中设置了该文件)。 -在 todo.txt 的缓冲区(窗口*,您可以按 **a** 添加新任务并和按 **c** 标记它已被完成。你还可以使用 **r** 设置优先级,并使用 **t** 添加项目和上下文。 -完成事项后只需要按下 **A** 即可将任务移如 **done.txt**。你可以使用**/**过滤列表,也可以使用 **l** 刷新完整列表。同样,您可以按 **q** 退出。 +输入 `Meta+x todotxt` 启动它将加载 `todotxt-file` 变量中指定的 `todo.txt` 文件(本文的第一部分中设置了该文件)。在 `todo.txt` 的缓冲区(窗口),你可以按 `a` 添加新任务并和按 `c` 标记它已被完成。你还可以使用 `r` 设置优先级,并使用 `t` 添加项目和上下文。完成事项后只需要按下 `A` 即可将任务移如 `done.txt`。你可以使用 `/` 过滤列表,也可以使用 `l` 刷新完整列表。同样,你可以按 `q` 退出。 #### 在 Emacs 中使用 ERC 进行交谈 ![使用 ERC 与人交谈 ][10] -Vim 的缺点之一是很难用它与人交谈。另一方面,Emacs 则将 [ERC][11] 客户端内置到默认发行版中。使用 `Meta+x ERC` 启动 ERC,系统将提示您输入服务器、用户名和密码。你可以使用几天前介绍设置 [BitlBee][12] 时使用的相同信息:服务器为 **localhost**,端口为 **6667**,相同用户名,无需密码。 -ERC 使用起来与其他 IRC 客户端一样。每个频道单独一个缓冲区(窗口),您可以使用 `Ctrl+x ctrl+b` 进行频道间切换,这也可以在 Emacs 中的其他缓冲区之间进行切换。`/quit` 命令将退出 ERC。 +Vim 的缺点之一是很难用它与人交谈。另一方面,Emacs 则将 [ERC][11] 客户端内置到默认发行版中。使用 `Meta+x ERC` 启动 ERC,系统将提示你输入服务器、用户名和密码。你可以使用几天前介绍设置 [BitlBee][12] 时使用的相同信息:服务器为 `localhost`,端口为 `6667`,相同用户名,无需密码。 + +ERC 使用起来与其他 IRC 客户端一样。每个频道单独一个缓冲区(窗口),你可以使用 `Ctrl+x ctrl+b` 进行频道间切换,这也可以在 Emacs 中的其他缓冲区之间进行切换。`/quit` 命令将退出 ERC。 #### 使用 Gnus 阅读电子邮件,Reddit 和 RSS ![Mail,Reddit,and RSS feeds with Gnus][13] 我相信昨天在我提及在 Emacs 中阅读邮件时,许多 Emacs 的老用户会问,“怎么没有 [Gnus][14] 呢?” -这个疑问很合理。Gnus 是一个内置在 Emacs 中的邮件和新闻阅读器,尽管它这个邮件阅读器不支持以 [Notmuch][15] 作为搜索引擎。但是,如果你将其配置来阅读 Reddit 和 RSS feed( 稍后您将这样做),那么同时使用它来阅读邮件是个聪明的选择。 -Gnus 是为阅读 Usenet 新闻而创建的,并从此发展而来。因此,它的很多外观和感觉(以及术语)看起来很像 Usenet 的新闻阅读器。 +这个疑问很合理。Gnus 是一个内置在 Emacs 中的邮件和新闻阅读器,尽管它这个邮件阅读器不支持以 [Notmuch][15] 作为搜索引擎。但是,如果你将其配置来阅读 Reddit 和 RSS feed(稍后你将这样做),那么同时使用它来阅读邮件是个聪明的选择。 -Gnus 以 `~/.gnus` 作为自己的配置文件。(该配置也可以包含在 `~/.emacs.d/init.el` 中)。使用 `Ctrl+x Ctrl+f` 打开 `~/.gnus`,并添加以下内容: +Gnus 是为阅读 Usenet 新闻而创建的,并从此发展而来。因此,它的很多外观和感觉(以及术语)看起来很像 Usenet 的新闻阅读器。 + +Gnus 以 `~/.gnus` 作为自己的配置文件。(该配置也可以包含在 `~/.emacs.d/init.el` 中)。使用 `Ctrl+x Ctrl+f` 打开 `~/.gnus`,并添加以下内容: ``` @@ -104,19 +104,17 @@ Gnus 以 `~/.gnus` 作为自己的配置文件。(该配置也可以包含在 `~              '(nnreddit "")) ``` -用 `Ctrl+x Ctrl+s` 保存文件。这分配置告诉 Gnus 从 `~/Maildir` 这个本地邮箱中读取邮件作为主源(参见 **gnus-select-method** 变量),并使用 [nnreddit][16] 插件添加辅源 (**gnus-secondary-select-methods** 变量)。你还可以定义多个辅助源,包括 Usenet 新闻 (nntp)、IMAP (nnimap)、mbox (nnmbox) 和虚拟集合 (nnvirtual)。您可以在 [Gnus 手册 ][17] 中了解更多有关所有选项的信息。 +用 `Ctrl+x Ctrl+s` 保存文件。这分配置告诉 Gnus 从 `~/Maildir` 这个本地邮箱中读取邮件作为主源(参见 `gnus-select-method` 变量),并使用 [nnreddit][16] 插件添加辅源(`gnus-secondary-select-methods` 变量)。你还可以定义多个辅助源,包括 Usenet 新闻(nntp)、IMAP (nnimap)、mbox(nnmbox)和虚拟集合(nnvirtual)。你可以在 [Gnus 手册][17] 中了解更多有关所有选项的信息。 -保存文件后,使用 `Meta+x Gnus` 启动 Gnus。第一次运行将在 Python 虚拟环境中安装 [Reddit 终端查看器 ][18],Gnus 通过它获取 Reddit 上的文章。然后它会启动浏览器来登录 Reddit。之后,它会扫描并加载你订阅的 Reddit 群组。你会看到一个有新邮件的邮件夹列表和一个有新内容的看板列表。在任一列表上按 **Enter** 将加载该组中的消息列表。您可以使用**箭头**键导航并按 **Enter** 加载和读取消息。在查看消息列表时,按 **q** 将返回到前一个视图,从主窗口按 **q** 将退出 Gnus。在阅读 Reddit 群组时,**a** 会创建一条新消息;在邮件组中,**m** 创建一个新的电子邮件;并且在任何一个视图中按 **r** 回复邮件。 +保存文件后,使用 `Meta+x Gnus` 启动 Gnus。第一次运行将在 Python 虚拟环境中安装 [Reddit 终端查看器][18],Gnus 通过它获取 Reddit 上的文章。然后它会启动浏览器来登录 Reddit。之后,它会扫描并加载你订阅的 Reddit 群组。你会看到一个有新邮件的邮件夹列表和一个有新内容的看板列表。在任一列表上按回车将加载该组中的消息列表。你可以使用箭头键导航并按回车加载和读取消息。在查看消息列表时,按 `q` 将返回到前一个视图,从主窗口按 `q` 将退出 Gnus。在阅读 Reddit 群组时,`a` 会创建一条新消息;在邮件组中,`m` 创建一个新的电子邮件;并且在任何一个视图中按 `r` 回复邮件。 -您还可以向 Gnus 接口中添加 RSS feed,并像阅读邮件和新闻组一样阅读它们。要添加 RSS feed,输入 `G+R` 并填写 RSS feed 的 URL。会有提示让你输入 feed 的标题和描述,这些信息可以从 feed 中提取出来并填充进去。现在输入 **g** 来检查新消息(这将检查所有组中的新消息)。阅读 feed 就像阅读 Reddit 群组和邮件一样,它们使用相同的快捷键。 +你还可以向 Gnus 接口中添加 RSS 流,并像阅读邮件和新闻组一样阅读它们。要添加 RSS 流,输入 `G+R` 并填写 RSS 流的 URL。会有提示让你输入 RSS 的标题和描述,这些信息可以从流中提取出来并填充进去。现在输入 `g` 来检查新消息(这将检查所有组中的新消息)。阅读 RSS 流 就像阅读 Reddit 群组和邮件一样,它们使用相同的快捷键。 -Gnus 中有_很多_功能,还有大量的键组合。[Gnus 参考卡 ][19] 为每个视图列出了所有这些键组合(以非常小的字体显示在 5 页纸上)。 +Gnus 中有*很多*功能,还有大量的键组合。[Gnus 参考卡][19]为每个视图列出了所有这些键组合(以非常小的字体显示在 5 页纸上)。 #### 使用 nyan-mode 查看位置 -As a final note,you might notice [Nyan cat][20] at the bottom of some of my screenshots。This is [nyan-mode][21],which indicates where you are in a buffer,so it gets longer as you get closer to the bottom of a document or buffer。You can install it with the package manager and set it up with the following code in **~/.emacs.d/init.el**: -最后,你可能会一些截屏底部注意到 [Nyan cat][20]。这是 [nyan-mode][21],它指示了你在缓冲区中的位置,因此当您接近文档或缓冲区的底部时,它会变长。您可以使用包管理器安装它,并在 `~/.emacs.d/init.el` 中使用以下代码进行设置: - +最后,你可能会一些截屏底部注意到 [Nyan cat][20]。这是 [nyan-mode][21],它指示了你在缓冲区中的位置,因此当你接近文档或缓冲区的底部时,它会变长。你可以使用包管理器安装它,并在 `~/.emacs.d/init.el` 中使用以下代码进行设置: ``` ;; Nyan Cat @@ -125,9 +123,9 @@ As a final note,you might notice [Nyan cat][20] at the bottom of some of my sc (nyan-mode) ``` -### Emacs 的皮毛 +### Emacs 的基本功能 -这只是 Emacs 所有功能的皮毛。Emacs_ 非常_强大,是我用来提高工作效率的必要工具之一,无论我是在追踪待办事项、阅读和回复邮件、编辑文本,还是与朋友和同事交流我都用它。这需要一点时间来适应,但是一旦你习惯了,它就会成为你桌面上最有用的工具之一。 +这只是 Emacs 所有功能的皮毛。Emacs *非常*强大,是我用来提高工作效率的必要工具之一,无论我是在追踪待办事项、阅读和回复邮件、编辑文本,还是与朋友和同事交流我都用它。这需要一点时间来适应,但是一旦你习惯了,它就会成为你桌面上最有用的工具之一。 -------------------------------------------------------------------------------- @@ -136,14 +134,14 @@ via: https://opensource.com/article/20/1/emacs-social-track-todo-list 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者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/ksonney [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) -[2]: https://opensource.com/article/20/1/emacs-mail-calendar +[2]: https://linux.cn/article-11932-1.html [3]: https://opensource.com/sites/default/files/uploads/productivity_19-1.png (All the things with Emacs) [4]: https://opensource.com/sites/default/files/uploads/productivity_19-2.png (Twitter in Emacs) [5]: https://github.com/hayamiz/twittering-mode @@ -153,10 +151,10 @@ via: https://opensource.com/article/20/1/emacs-social-track-todo-list [9]: http://todotxt.org/ [10]: https://opensource.com/sites/default/files/uploads/productivity_19-4.png (Chatting with erc) [11]: https://www.gnu.org/software/emacs/manual/html_mono/erc.html -[12]: https://opensource.com/article/20/1/open-source-chat-tool +[12]: https://linux.cn/article-11856-1.html [13]: https://opensource.com/sites/default/files/uploads/productivity_19-5.png (Mail, Reddit, and RSS feeds with Gnus) [14]: https://www.gnus.org/ -[15]: https://opensource.com/article/20/1/organize-email-notmuch +[15]: https://linux.cn/article-11807-1.html [16]: https://github.com/dickmao/nnreddit [17]: https://www.gnus.org/manual/gnus.html [18]: https://pypi.org/project/rtv/ From 777a63e16c44aa36eec1906520a883323a786c5e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Mar 2020 10:11:26 +0800 Subject: [PATCH 197/260] PUB @lujun9972 https://linux.cn/article-11956-1.html --- ...200129 Use Emacs to get social and track your todo list.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200129 Use Emacs to get social and track your todo list.md (99%) diff --git a/translated/tech/20200129 Use Emacs to get social and track your todo list.md b/published/20200129 Use Emacs to get social and track your todo list.md similarity index 99% rename from translated/tech/20200129 Use Emacs to get social and track your todo list.md rename to published/20200129 Use Emacs to get social and track your todo list.md index 88e21c0f94..0d7bbc42c5 100644 --- a/translated/tech/20200129 Use Emacs to get social and track your todo list.md +++ b/published/20200129 Use Emacs to get social and track your todo list.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11956-1.html) [#]: subject: (Use Emacs to get social and track your todo list) [#]: via: (https://opensource.com/article/20/1/emacs-social-track-todo-list) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From b51fc20c83fb670333651c6c8ed64f1fe4ad04cb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Mar 2020 11:22:43 +0800 Subject: [PATCH 198/260] PRF @HankChow --- ...to know about domain-specific languages.md | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/translated/tech/20200224 What developers need to know about domain-specific languages.md b/translated/tech/20200224 What developers need to know about domain-specific languages.md index 299ed726fc..f0578a307f 100644 --- a/translated/tech/20200224 What developers need to know about domain-specific languages.md +++ b/translated/tech/20200224 What developers need to know about domain-specific languages.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What developers need to know about domain-specific languages) @@ -8,29 +8,29 @@ [#]: author: (Girish Managoli https://opensource.com/users/gammay) -开发者需要了解的领域特定语言 +开发者需要了解的领域特定语言(DSL) ====== + > 领域特定语言是在特定领域下用于特定上下文的语言。作为开发者,很有必要了解领域特定语言的含义,以及为什么要使用特定领域语言。 -![Various programming languages in use][1] +![](https://img.linux.net.cn/data/attachment/album/202003/04/112240b0os2988kolritlo.jpg) -领域特定语言domain-specific language(DSL)是在特定领域下用于特定上下文的语言。这里的领域是指某种商业上的(例如银行业、保险业等)上下文,也可以指某种应用程序的(例如 Web 应用、数据库等)上下文。与之相比的另一个概念是通用语言general-purpose language(GPL),通用语言则可以广泛应用于各种商业或应用问题当中。 +领域特定语言domain-specific language(DSL)是一种旨在特定领域下的上下文的语言。这里的领域是指某种商业上的(例如银行业、保险业等)上下文,也可以指某种应用程序的(例如 Web 应用、数据库等)上下文。与之相比的另一个概念是通用语言general-purpose language(GPL,LCTT 译注:注意不要和 GPL 许可证混淆),通用语言则可以广泛应用于各种商业或应用问题当中。 DSL 并不具备很强的普适性,它是仅为某个适用的领域而设计的,但它也足以用于表示这个领域中的问题以及构建对应的解决方案。HTML 是 DSL 的一个典型,它是在 Web 应用上使用的语言,尽管 HTML 无法进行数字运算,但也不影响它在这方面的广泛应用。 -而 GPL 则没有特定针对的领域,GPL 的设计者不可能知道这种语言会在什么领域被使用,更不清楚用户打算解决的问题是什么,因此 GPL 会被设计成可用于解决任何一种问题、适合任何一种业务、满足任何一种需求。例如 Java 就属于 GPL,它可以在 PC 或移动设备上运行,嵌入到银行、金融、保险、制造业等各种行业的应用中去。 +而 GPL 则没有特定针对的领域,这种语言的设计者不可能知道这种语言会在什么领域被使用,更不清楚用户打算解决的问题是什么,因此 GPL 会被设计成可用于解决任何一种问题、适合任何一种业务、满足任何一种需求。例如 Java 就属于 GPL,它可以在 PC 或移动设备上运行,嵌入到银行、金融、保险、制造业等各种行业的应用中去。 ### DSL 的类别 从使用方式的角度,语言可以划分出以下两类: - * DSL:使用 DSL 形式编写或表示的语言 - * 宿主语言host language:用于执行或处理 DSL 的语言 +* DSL:使用 DSL 形式编写或表示的语言 +* 宿主语言host language:用于执行或处理 DSL 的语言 -当 DSL 以独有的形式表达,并由另一种宿主语言来处理时,这种 DSL 称为外部external DSL。 - -以下就是可以在宿主语言中处理的 SQL: +由不同的语言编写并由另一种宿主语言处理的 DSL 被称为外部external DSL。 +以下就是可以在宿主语言中处理的 SQL 形式的 DSL: ``` SELECT account @@ -40,22 +40,27 @@ WHERE account = '123' AND branch = 'abc' AND amount >= 1000 因此,只要在规定了词汇和语法的情况下,DSL 也可以直接使用英语来编写,并使用诸如 ANTLR 这样的解析器生成器parser generator以另一种宿主语言来处理 DSL: - ``` -`if smokes then increase premium by 10%` +if smokes then increase premium by 10% ``` -如果 DSL 和宿主语言是同一种语言,这种 DSL 称为内部internal DSL,其中 DSL 由以同一种语义的宿主语言编写和处理,因此又称为嵌入式embedded DSL。以下是两个例子: +如果 DSL 和宿主语言是同一种语言,这种 DSL 称为内部internalDSL,其中 DSL 由以同一种语义的宿主语言编写和处理,因此又称为嵌入式embedded DSL。以下是两个例子: - * Bash 形式的 DSL 可以由 Bash 解释器执行:`if today_is_christmas; then apply_christmas_discount; fi` 同时这也是一段看起来符合英语语法的 Bash。 - * 使用类似 Java 语法编写的 DSL: +* Bash 形式的 DSL 可以由 Bash 解释器执行: + + ``` +if today_is_christmas; then apply_christmas_discount; fi ``` + 同时这也是一段看起来符合英语语法的 Bash。 +* 使用类似 Java 语法编写的 DSL: + + ``` orderValue = orderValue .applyFestivalDiscount() .applyCustomerLoyalityDiscount() .applyCustomerAgeDiscount(); ``` -这一段的可读性也相当强。 + 这一段的可读性也相当强。 实际上,DSL 和 GPL 之间并没有非常明确的界限。 @@ -63,18 +68,16 @@ orderValue = orderValue 以下这些语言都可以作为 DSL 使用: - * Web 应用:HTML - * Shell:用于类 Unix 系统的 sh、Bash、CSH 等;用于 Windows 系统的 MS-DOS、Windows Terminal、PowerShell 等 - * 标记语言:XML - * 建模:UML - * 数据处理:SQL 及其变体 - * 业务规则管理:Drools - * 硬件:Verilog、VHD - * 构建工具:Maven、Gradle - * 数值计算和模拟:MATLAB(商业)、GNU Octave、Scilab - * 解析器和生成器:Lex、YACC、GNU Bison、ANTLR - - +* Web 应用:HTML +* Shell:用于类 Unix 系统的 sh、Bash、CSH 等;用于 Windows 系统的 MS-DOS、Windows Terminal、PowerShell 等 +* 标记语言:XML +* 建模:UML +* 数据处理:SQL 及其变体 +* 业务规则管理:Drools +* 硬件:Verilog、VHD +* 构建工具:Maven、Gradle +* 数值计算和模拟:MATLAB(商业)、GNU Octave、Scilab +* 解析器和生成器:Lex、YACC、GNU Bison、ANTLR ### 为什么要使用 DSL? @@ -92,25 +95,22 @@ DSL 的优点是,它对于领域的特征捕捉得非常好,同时它不像 开源的 DSL 软件包括: - * Xtext:Xtext 可以与 Eclipse 集成,并支持 DSL 开发。它能够实现代码生成,因此一些开源和商业产品都用它来提供特定的功能。用于农业活动建模分析的多用途农业数据系统Multipurpose Agricultural Data System(MADS)就是基于 Xtext 实现的一个项目,可惜的是这个项目现在已经不太活跃了。 - * JetBrains MPS:JetBrains MPS 是一个可供开发 DSL 的集成开发环境Integrated Development Environment,它将文档在底层存储为一个抽象树结构(Microsoft Word 也使用了这一概念),因此它也自称为一个投影编辑器projectional editor。JetBrains MPS 支持 Java、C、JavaScript 和 XML 的代码生成。 +* Xtext:Xtext 可以与 Eclipse 集成,并支持 DSL 开发。它能够实现代码生成,因此一些开源和商业产品都用它来提供特定的功能。用于农业活动建模分析的多用途农业数据系统Multipurpose Agricultural Data System(MADS)就是基于 Xtext 实现的一个项目,可惜的是这个项目现在已经不太活跃了。 +* JetBrains MPS:JetBrains MPS 是一个可供开发 DSL 的集成开发环境Integrated Development Environment,它将文档在底层存储为一个抽象树结构(Microsoft Word 也使用了这一概念),因此它也自称为一个投影编辑器projectional editor。JetBrains MPS 支持 Java、C、JavaScript 和 XML 的代码生成。 ### DSL 的最佳实践 如果你想使用 DSL,记住以下几点: - * DSL 不同于 GPL,DSL 只能用于解决特定领域中有限范围内的问题。 - * 不必动辄建立自己的 DSL,可以首先尝试寻找已有的 DSL。例如 [DSLFIN][4] 这个网站就提供了很多金融方面的 DSL。在实在找不到合适的 DSL 的情况下,才需要建立自己的 DSL。 - * DSL 最好像平常的语言一样具有可读性。 - * 尽管代码生成不是一项必需的工作,但它确实会大大提高工作效率。 - * 虽然 DSL 被称为语言,但 DSL 不需要像 GPL 一样可以被执行,可执行性并不是 DSL 需要达到的目的。 - * DSL 可以使用文本编辑器编写,但专门的 DSL 编辑器可以更轻松地完成 DSL 的语法和语义检查。 - - +* DSL 不同于 GPL,DSL 只能用于解决特定领域中有限范围内的问题。 +* 不必动辄建立自己的 DSL,可以首先尝试寻找已有的 DSL。例如 [DSLFIN][4] 这个网站就提供了很多金融方面的 DSL。在实在找不到合适的 DSL 的情况下,才需要建立自己的 DSL。 +* DSL 最好像平常的语言一样具有可读性。 +* 尽管代码生成不是一项必需的工作,但它确实会大大提高工作效率。 +* 虽然 DSL 被称为语言,但 DSL 不需要像 GPL 一样可以被执行,可执行性并不是 DSL 需要达到的目的。 +* DSL 可以使用文本编辑器编写,但专门的 DSL 编辑器可以更轻松地完成 DSL 的语法和语义检查。 如果你正在使用或将要使用 DSL,欢迎在评论区留言。 - -------------------------------------------------------------------------------- via: https://opensource.com/article/20/2/domain-specific-languages @@ -118,7 +118,7 @@ via: https://opensource.com/article/20/2/domain-specific-languages 作者:[Girish Managoli][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7a14c7909813c0b5936ed89f9b0c7d88c8055bae Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Mar 2020 11:23:43 +0800 Subject: [PATCH 199/260] PUB @HankChow https://linux.cn/article-11957-1.html --- ...developers need to know about domain-specific languages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200224 What developers need to know about domain-specific languages.md (99%) diff --git a/translated/tech/20200224 What developers need to know about domain-specific languages.md b/published/20200224 What developers need to know about domain-specific languages.md similarity index 99% rename from translated/tech/20200224 What developers need to know about domain-specific languages.md rename to published/20200224 What developers need to know about domain-specific languages.md index f0578a307f..c0e01b7923 100644 --- a/translated/tech/20200224 What developers need to know about domain-specific languages.md +++ b/published/20200224 What developers need to know about domain-specific languages.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11957-1.html) [#]: subject: (What developers need to know about domain-specific languages) [#]: via: (https://opensource.com/article/20/2/domain-specific-languages) [#]: author: (Girish Managoli https://opensource.com/users/gammay) From c8eadb41681baeea182c8a3da5fc1d6b0437442f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Mar 2020 12:16:14 +0800 Subject: [PATCH 200/260] PRF @wxy --- ...d the life of your SSD drive with fstrim.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20200212 Extend the life of your SSD drive with fstrim.md b/translated/tech/20200212 Extend the life of your SSD drive with fstrim.md index 24ed876272..439c9524a7 100644 --- a/translated/tech/20200212 Extend the life of your SSD drive with fstrim.md +++ b/translated/tech/20200212 Extend the life of your SSD drive with fstrim.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Extend the life of your SSD drive with fstrim) @@ -12,9 +12,9 @@ > 这个新的系统服务可以使你的生活更轻松。 -![Linux keys on the keyboard for a desktop computer][1] +![](https://img.linux.net.cn/data/attachment/album/202003/04/121625sl380ga10g56d33h.jpg) -在过去的十年中,固态驱动器(SSD)带来了一种管理存储的新方法。与上一代的转盘产品相比,SSD 具有无声、更冷却的操作和更快的接口规格等优点。当然,新技术带来了新的维护和管理方法。SSD 具有称为 TRIM 的功能。从本质上讲,这是一种用于回收设备上未使用的块的方法,该块可能先前已被写入,但不再包含有效数据,因此可以返回到通用存储池以供重用。Opensource.com 的 Don Watkins 在首先其 2017 年的文章《[Linux 固态驱动器:为 SSD 启用 TRIM][2]》中介绍了 TRIM 的内容。 +在过去的十年中,固态驱动器(SSD)带来了一种管理存储的新方法。与上一代的转盘产品相比,SSD 具有无声、更冷却的操作和更快的接口规格等优点。当然,新技术带来了新的维护和管理方法。SSD 具有一种称为 TRIM 的功能。从本质上讲,这是一种用于回收设备上未使用的块的方法,该块可能先前已被写入,但不再包含有效数据,因此可以返回到通用存储池以供重用。Opensource.com 的 Don Watkins 首先在其 2017 年的文章《[Linux 固态驱动器:为 SSD 启用 TRIM][2]》中介绍过 TRIM 的内容。 如果你一直在 Linux 系统上使用此功能,则你可能熟悉下面描述的两种方法。 @@ -29,7 +29,7 @@ UUID=3453g54-6628-2346-8123435f  /home  xfs  defaults,discard   0 0 ``` -丢弃选项可启用自动的在线 TRIM。由于可能会对性能造成负面影响,最近关于这是否是最佳方法一直存在争议。使用此选项会在每次将新数据写入驱动器时启动 TRIM。这可能会引入其他活动,从而影响存储性能。 +丢弃选项可启用自动的在线 TRIM。由于可能会对性能造成负面影响,最近关于这是否是最佳方法一直存在争议。使用此选项会在每次将新数据写入驱动器时启动 TRIM。这可能会引入其他磁盘活动,从而影响存储性能。 #### Cron 作业 @@ -44,7 +44,7 @@ UUID=3453g54-6628-2346-8123435f  /home  xfs  defaults,discard   0 0 ### 一个新的 TRIM 服务 -我最近发现有一个用于 TRIM 的 systemd 服务。Fedora 在版本 30 中将其[引入][3],尽管默认情况下在版本 30 和 31 中未启用它,但计划在版本 32 中使用它。如果你使用的是 Fedora 工作站 31,并且你想要开始使用此功能,可以非常轻松地启用它。我还将在下面向你展示如何对其进行测试。该服务并非 Fedora 独有的服务。它是否存在和地位将因发行版而异。 +我最近发现有一个用于 TRIM 的 systemd 服务。Fedora 在版本 30 中将其[引入][3],尽管默认情况下在版本 30 和 31 中未启用它,但计划在版本 32 中使用它。如果你使用的是 Fedora 工作站 31,并且你想要开始使用此功能,可以非常轻松地启用它。我还将在下面向你展示如何对其进行测试。该服务并非 Fedora 独有的服务。它是否存在及其地位将因发行版而异。 #### 测试 @@ -78,7 +78,7 @@ Options: -V, --version display version ``` -因此,现在我可以看到这个 systemd 服务已配置为在我的 `/etc/fstab` 文件中的所有受支持的挂载文件系统上运行该修剪操作( `-fstab`),并打印出丢弃的字节数(`-verbose`),但是抑制了任何可能会发生的错误消息(`–quiet`)。了解这些选项对测试很有帮助。例如,我可以从最安全的方法开始,即空运行。 我还将去掉 `-quiet` 参数,以便确定驱动器设置是否发生任何错误。 +因此,现在我可以看到这个 systemd 服务已配置为在我的 `/etc/fstab` 文件中的所有受支持的挂载文件系统上运行该修剪操作(`-fstab`),并打印出所丢弃的字节数(`-verbose`),但是抑制了任何可能会发生的错误消息(`–quiet`)。了解这些选项对测试很有帮助。例如,我可以从最安全的方法开始,即空运行。我还将去掉 `-quiet` 参数,以便确定驱动器设置是否发生任何错误。 ``` $ sudo /usr/sbin/fstrim --fstab --verbose --dry-run @@ -101,7 +101,7 @@ $ sudo /usr/sbin/fstrim --fstab --verbose #### 启用 -Fedora Linux 实现了一个计划每周运行它的 systemd 计时器服务。要检查其是否存在和当前状态,请运行 `systemctl status`。 +Fedora Linux 实现了一个计划每周运行它的 systemd 计时器服务。要检查其是否存在及当前状态,请运行 `systemctl status`。 ``` $ sudo systemctl status fstrim.timer @@ -121,7 +121,7 @@ $ sudo systemctl enable fstrim.timer $ sudo systemctl list-timers --all ``` -会显示出下列表明 `fstrim.timer` 存在的行。注意,该计时器实际上激活了 `fstrim.service`。这是 `fstrim` 实际调用的地方。与时间相关的字段显示为 `n/a`,因为该服务已启用且尚未运行。 +会显示出下列行,表明 `fstrim.timer` 存在。注意,该计时器实际上激活了 `fstrim.service` 服务。这是实际调用 `fstrim` 的地方。与时间相关的字段显示为 `n/a`,因为该服务已启用且尚未运行。 ``` NEXT   LEFT    LAST   PASSED   UNIT           ACTIVATES @@ -141,7 +141,7 @@ via: https://opensource.com/article/20/2/trim-solid-state-storage-linux 作者:[Alan Formy-Duval][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 9f238d0eeee284460edc7e5ba069949b0b1dde2f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Mar 2020 12:17:35 +0800 Subject: [PATCH 201/260] PUB @wxy https://linux.cn/article-11959-1.html --- .../20200212 Extend the life of your SSD drive with fstrim.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200212 Extend the life of your SSD drive with fstrim.md (98%) diff --git a/translated/tech/20200212 Extend the life of your SSD drive with fstrim.md b/published/20200212 Extend the life of your SSD drive with fstrim.md similarity index 98% rename from translated/tech/20200212 Extend the life of your SSD drive with fstrim.md rename to published/20200212 Extend the life of your SSD drive with fstrim.md index 439c9524a7..dfb2969cf9 100644 --- a/translated/tech/20200212 Extend the life of your SSD drive with fstrim.md +++ b/published/20200212 Extend the life of your SSD drive with fstrim.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11959-1.html) [#]: subject: (Extend the life of your SSD drive with fstrim) [#]: via: (https://opensource.com/article/20/2/trim-solid-state-storage-linux) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) From 5ea37b69d253a13e65cf2217aa52fa5cf00db6de Mon Sep 17 00:00:00 2001 From: heguangzhi <7731226@qq.com> Date: Wed, 4 Mar 2020 15:32:42 +0800 Subject: [PATCH 202/260] Transtlated --- ...t you-re looking for on Linux with find.md | 240 ----------------- ...t you-re looking for on Linux with find.md | 241 ++++++++++++++++++ 2 files changed, 241 insertions(+), 240 deletions(-) delete mode 100644 sources/tech/20200219 How to find what you-re looking for on Linux with find.md create mode 100644 translated/tech/20200219 How to find what you-re looking for on Linux with find.md diff --git a/sources/tech/20200219 How to find what you-re looking for on Linux with find.md b/sources/tech/20200219 How to find what you-re looking for on Linux with find.md deleted file mode 100644 index 9bcb73d4e5..0000000000 --- a/sources/tech/20200219 How to find what you-re looking for on Linux with find.md +++ /dev/null @@ -1,240 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (heguangzhi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to find what you’re looking for on Linux with find) -[#]: via: (https://www.networkworld.com/article/3527420/how-to-find-what-you-re-looking-for-on-linux-with-find.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -How to find what you’re looking for on Linux with find -====== -The find command has a huge array of options to help you locate exactly the files you're looking for on a Linux system. This post explores a series of extremely useful commands. -CSA Images / Getty Images - -There are a number of commands for finding files on Linux systems, but there are also a huge number of options that you can deploy when looking for them. - -For example, you can find files not just by their names, but by their owners and/or groups, their age, their size, the assigned permissions, the last time they were accessed, the associated inodes and even whether the files belong to an account or group that no longer exists on the system and so on. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] - -You can also specify where a search should start, how deeply into the file system the search should reach and how much the search result will tell you about the files it finds. - -And all these criteria can be handled by the **find** command. - -Examples of finding files by these criteria are provided below. In some commands, errors (such as trying to list files that you don’t have read access to), error output will be sent to **/dev/null** so that we don’t have to look at it. In others, we’ll simply run as root to avoid this problem. - -Keep in mind that additional options exist. This post covers a lot of ground, but not all of the ways that the **find** command can help locate files for you. - -### Picking a starting point - -With **find**, you can either select a point or start where you are. To select a starting spot, enter it following the word “find”. For example, “find /usr” or “find ./bin” would search starting the **/usr** directory or the **bin** directory in the current location while “find ~” would start in your home directory even if you’re currently located in some other location in the file system. - -[][2] - -### Picking what you want to see - -One of the most commonly used search strategies is to search for files by name. This requires using the **-name** option. - -By default, **find** will show you the full path to the files it finds. This is the same thing you would see if you add **-print** to your command. If you want to see the details associated with a file – its length, permissions, etc., you would need to add **-ls** to the end of your **find** command. - -``` -$ find ~/bin -name tryme -/home/shs/bin/tryme -$ find ~/bin -name tryme -print -/home/shs/bin/tryme -$ find ~/bin -name tryme -ls - 917528 4 -rwx------ 1 shs shs 139 Apr 8 2019 /home/shs/bin/tryme -``` - -You can also find files using substrings. For example, if you replace "tryme" in the example above with "try*", you'll find all the files with names that begin with "try". - -Finding files by name is probably the most typical use of the **find** command, but there are so many other ways to look for files and good reasons to want to. The sections below show how to use many of the other criteria available. - -In addition, when searching for files by size, group, inode etc., you probably will want some confirmation that the files found match what you were looking for. Using the **-ls** option to display the details is often very helpful. - -### Finding files by size - -Finding files by size requires use of the **-size** option and a little finesse with the specifications. If you specify **-size 189b**, for you example, you’re going to find files that are 189 blocks long, not 189 bytes. For bytes, you would need to use **-size 189c** (characters). And, if you specify **-size 200w**, you’re going to find files that are 200 words – words as in "two-byte increments", not words as in "those things we all say to each other". You can also look for file by providing sizes in kilobytes (k), megabytes (M) and gigabytes (G). - -Most of the time, Linux users will be searching for files that are larger than some selected size. For example, to find files that are larger than a gigabyte, you might use a command like this where the +1G means "larger than a gigabyte": - -``` -$ find -size +1G -ls 2>/dev/null - 787715 1053976 -rw-rw-r-- 1 shs shs 1079263432 Dec 21 2018 ./backup.zip - 801834 1052556 -rw-rw-r-- 1 shs shs 1077809525 Dec 21 2018 ./2019/hold.zip -``` - -### Finding files by inode # - -You can find files by the inode that is used to maintain the file’s metadata (i.e., everything but the file content and file name). - -``` -$ find -inum 919674 -ls 2>/dev/null - 919674 4 -rw-rw-r-- 1 shs shs 512 Dec 27 15:25 ./bin/my.log -``` - -### Finding files with a specific file owner or group - -Finding files by owner or group is also very straightforward. Here we use sudo to overcome permission issues. - -``` -$ sudo find /home -user nemo -name "*.png"-ls - 1705219 4 drwxr-xr-x 2 nemo nemo 4096 Jan 28 08:50 /home/nemo/Pictures/me.png -``` - -In this command, we look for a file that is owned by a multi-user group called “admins”. - -``` -# find /tmp -group admins -ls - 262199 4 -rwxr-x--- 1 dory admins 27 Feb 16 18:57 /tmp/testscript -``` - -### Finding files with no owners or groups - -You can look for files that don't belong to any users currently set up on the system by using the **-nouser** option as shown in the command below. - -``` -# find /tmp -nouser -ls -262204 4 -rwx------ 1 1016 1016 17 Feb 17 16:42 /tmp/hello -``` - -Notice that the listing shows the old user's UID and GID – a clear indication that this user is not defined on the system. This kind of command will find files that were likely created in other-than-home directories by users whose accounts have since been removed from the system or in home directories that were not removed after the user account was removed. Similarly, the **-nogroup** option would find such files – especially when these users were the only members of the associated groups. - -### Finding files by last update time - -In this command, we look for files that have been updated in the last 24 hours in a particular user's home directory. The **sudo** is being used to allow searching another user’s home directory. - -``` -$ sudo find /home/nemo -mtime -1 -/home/nemo -/home/nemo/snap/cheat -/home/nemo/tryme -``` - -### Finding files by when permissions were last changed - -The **-ctime** option can help you find files that have had their status (e.g., permissions) changed within some referenced time frame. Here’s an example of looking for files that had permission changes within the last day: - -``` -$ find . -ctime -1 -ls - 787987 4 -rwxr-xr-x 1 shs shs 189 Feb 11 07:31 ./tryme -``` - -Keep in mind that the date and time displayed reflect the last updates to the file contents. You will have to use a command like **stat** to see all three times associated with a file (file creation, modification and status changes) . - -### Finding files based on last access times - -In this command, we look for local pdf files that were accessed within the last two days using the **-atime** option. - -``` -$ find -name "*.pdf" -atime -2 -./Wingding_Invites.pdf -``` - -### Finding files based on their age relative to another file - -You can use the -newer option to find files that are newer than some other file. - -``` -$ find . -newer dig1 -ls - 786434 68 drwxr-xr-x 67 shs shs 69632 Feb 16 19:05 . - 1064442 4 drwxr-xr-x 5 shs shs 4096 Feb 16 11:06 ./snap/cheat - 791846 4 -rw-rw-r-- 1 shs shs 649 Feb 13 14:26 ./dig -``` - -There is no corresponding **-older** option, but you can get a similar result with **! -newer** (i.e., not newer), which means almost the same thing. - -### Finding files by type - -Finding a file by file type, you get a lot of choices – regular files, directories, block and character files, etc. Here’s a list of the file type options: - -``` -b block (buffered) special -c character (unbuffered) special -d directory -p named pipe (FIFO) -f regular file -l symbolic link -s socket -``` - -Here’s an example looking for symbolic links: - -``` -$ find . -type l -ls - 805717 0 lrwxrwxrwx 1 shs shs 11 Apr 10 2019 ./volcano -> volcano.pdf - 918552 0 lrwxrwxrwx 1 shs shs 1 Jun 16 2018 ./letter -> pers/letter2mom -``` - -### Limiting how deeply find should look - -The **-mindepth** and **-maxdepth** options control how deeply into the file system (from the current location or starting point) your searches will look. - -``` -$ find -maxdepth 3 -name "*loop" -./bin/save/oldloop -./bin/long-loop -./private/loop -``` - -### Finding files only if empty - -In this command, we look for empty files, but no further than directories and their subdirectories. - -``` -$ find . -maxdepth 2 -empty -type f -ls - 917517 0 -rw-rw-r-- 1 shs shs 0 Sep 23 11:00 ./complaints/newfile - 792050 0 -rw-rw-r-- 1 shs shs 0 Oct 4 19:02 ./junk -``` - -### Finding files by permissions - -You can find files that have specific permissions set using the **-perm** option. In the example below, we are looking only for regular files (**-type f**) to avoid seeing symbolic links that are given these permissions by default even if the file they refer to is restricted. - -``` -$ find -perm 777 -type f -ls -find: ‘./.dbus’: Permission denied - 798748 4 -rwxrwxrwx 1 shs shs 15 Mar 28 2019 ./runme -``` - -### Using find to help you get rid of files - -You can use the find command to both locate and then remove files if you use a command like this one: - -``` -$ find . -name runme -exec rm {} \; -``` - -The {} represents the name of each of the files located by the search criteria. - -One very useful option is to replace **-exec** with **-ok**. When you do this, **find** will ask for a confirmation before it removes any file. - -``` -$ find . -name runme -ok rm -rf {} \; -< rm ... ./bin/runme > ? -``` - -Removing a file isn't the only thing that **-ok** and **-rm** can do for you. For example, you could copy, rename or move files. - -There are really a lot of options for using the find command effectively and undoubtedly some that haven’t been covered in this post. I hope you’ve found some that are new and especially promising. - -Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3527420/how-to-find-what-you-re-looking-for-on-linux-with-find.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者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/newsletters/signup.html -[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[3]: https://www.facebook.com/NetworkWorld/ -[4]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20200219 How to find what you-re looking for on Linux with find.md b/translated/tech/20200219 How to find what you-re looking for on Linux with find.md new file mode 100644 index 0000000000..f54e9a3924 --- /dev/null +++ b/translated/tech/20200219 How to find what you-re looking for on Linux with find.md @@ -0,0 +1,241 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to find what you’re looking for on Linux with find) +[#]: via: (https://www.networkworld.com/article/3527420/how-to-find-what-you-re-looking-for-on-linux-with-find.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux上通过 find 命令找到你要找的东西 +====== +find 命令有大量选项可以帮助你准确定位你在 Linux 系统上需要寻找的文件。这篇文章讨论了一系列非常有用的选项。 + +CSA 图片/ Getty 图片 + +在 Linux 系统上有许多用于查找文件的命令,但是在查找文件时也有大量的选项可以选择。 + +例如,你不仅可以通过文件的名称来查找文件,还可以通过文件的所有者或者组、它们的创建时间、大小、分配的权限、最后一次访问它们的时间、关联的信息节点,甚至是文件是否属于系统上不再存在的帐户或组等等来查找文件。 + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] +你还可以指定搜索从哪里开始,搜索应该深入到文件系统的什么位置,以及搜索结果将告诉你它所找到的文件的数量。 + +而所有这些要求都可以通过 **find** 命令来处理。 + +下面提供了根据这些标准查找文件的示例。在某些命令中,错误(例如试图列出你没有读取权限的文件),错误输出将被发送到 **/dev/null**,以便我们不必查看它。在其他情况下,我们将简单地以 root 身份运行以避免这个问题。 + +请记住,还其他选项存在。这篇文章涵盖了很多内容,但并不是 **find** 命令帮助你定位查找文件的所有方式。 + +### 选择起点 + +使用 **find**,您可以选择一个起点或从你所在的位置开始。请在单词“find”后输入要选择起点。例如,“find /usr” 或 “find ./bin "将在 **/usr** 目录或 **bin** 目录开始搜索,而" find ~ " 将在你的主目录中开始,即使你位于当前文件系统中的其他位置。 + +[][2] + +### 选择你想看的 + +最常用的搜索策略之一是按名称搜索文件。这需要使用 **-name** 选项。 + +默认情况下,**查找** 会显示找到的文件的完整路径。如果你在命令中添加 **-print**,你会看到同样的情况。如果你想查看与文件相关的详细信息—-例如:文件的长度、权限等,您需要在你的 **查找** 命令的末尾添加 **-ls** 命令。 + +``` +$ find ~/bin -name tryme +/home/shs/bin/tryme +$ find ~/bin -name tryme -print +/home/shs/bin/tryme +$ find ~/bin -name tryme -ls + 917528 4 -rwx------ 1 shs shs 139 Apr 8 2019 /home/shs/bin/tryme +``` + +你也可以使用子字符串来查找文件。例如,如果你将上面示例中的“tryme”替换为“try*”,你将会找到所有名称以“try”开头的文件。 + +按名称查找文件可能是 **find** 命令最典型的用法,但是有很多其他的方式来查找文件,并且有很好的理由这样做。下面的部分展示了如何使用其他可用的方式。 + +此外,当按大小、组、索引节点等条件来搜索文件时,你需要确认找到的文件与你要查找的文件是否相匹配。使用 **-ls** 选项来显示细节是非常有用。 + +### 通过大小查找文件 + +按大小查找文件需要使用 **-size** 选项并且对相应规范使用一点技巧。如果你指定 **-size 189b**,例如,你将找到189个块长的文件,而不是189个字节。对于字节,你需要使用 **--size 189c**(字符)。而且,如果你指定 **--size 200w** ,你将会找到200个单词的文件——以“双字节增量”为单位的单词,而不是“我们彼此都在说的那些事情”中的单词。你还可以通过以千字节(k)、兆字节(M)和千兆字节(G)为单位提供大小来查找文件。 + + +大多数情况下,Linux用户会搜索比所选文件大的文件。例如,要查找大于1千兆字节的文件,你可以使用这样的命令,其中 +1G 表示“大于1千兆字节”: + +``` +$ find -size +1G -ls 2>/dev/null + 787715 1053976 -rw-rw-r-- 1 shs shs 1079263432 Dec 21 2018 ./backup.zip + 801834 1052556 -rw-rw-r-- 1 shs shs 1077809525 Dec 21 2018 ./2019/hold.zip +``` + +### 通过索引节点查找文件 # + +你可以通过用于维护文件元数据(即除文件内容和文件名之外的所有内容)的索引节点来查找文件。 + +``` +$ find -inum 919674 -ls 2>/dev/null + 919674 4 -rw-rw-r-- 1 shs shs 512 Dec 27 15:25 ./bin/my.log +``` + +### 查找具有特定文件所有者或组的文件 + +按所有者或组查找文件也非常简单。这里我们使用 sudo 来解决权限问题。 + +``` +$ sudo find /home -user nemo -name "*.png"-ls + 1705219 4 drwxr-xr-x 2 nemo nemo 4096 Jan 28 08:50 /home/nemo/Pictures/me.png +``` + +在这个命令中,我们寻找一个被称为 “admins” 的多用户组拥有的文件。 + +``` +# find /tmp -group admins -ls + 262199 4 -rwxr-x--- 1 dory admins 27 Feb 16 18:57 /tmp/testscript +``` + +### 查找没有所有者或组的文件 + +你可以使用如下命令所示的 **-nouser** 选项来查找系统上没有任何现存用户属性的文件。 + +``` +# find /tmp -nouser -ls +262204 4 -rwx------ 1 1016 1016 17 Feb 17 16:42 /tmp/hello +``` + +请注意,该列表显示了旧用户的 UID 和 GID,这清楚地表明该用户未在系统上定义。这种命令将查找由于帐户已从系统中删除的用户在非主目录中创建的文件,或者在用户帐户被删除后未被删除的主目录中创建的文件。类似地,**-nogroup** 选项会找到这样的文件,尤其是当这些用户是相关组的唯一成员时。 + +### 按上次更新时间查找文件 + +在此命令中,我们在特定用户的主目录中查找过去24小时内更新过的文件。**sudo** 用于搜索另一个用户的主目录。 + +``` +$ sudo find /home/nemo -mtime -1 +/home/nemo +/home/nemo/snap/cheat +/home/nemo/tryme +``` + +### 按上次更改权限的时间查找文件 + +**-ctime** 选项可以帮助你查找在某个参考时间范围内状态(如权限)发生更改的文件。以下是查找在最后一天内权限发生更改的文件的示例: + +``` +$ find . -ctime -1 -ls + 787987 4 -rwxr-xr-x 1 shs shs 189 Feb 11 07:31 ./tryme +``` + +请记住,显示的日期和时间反映了文件内容的最后更新。你需要使用像 **stat** 这样的命令来查看与文件相关联的三个状态(文件创建、修改和状态更改)。 + +### Finding files based on last access times + +在这个命令中,我们使用 **-atime** 选项查找在过去两天内访问过的本地 pdf 文件。 + +``` +$ find -name "*.pdf" -atime -2 +./Wingding_Invites.pdf +``` + +### 根据文件相对于另一个文件的时间来查找文件 + +你可以使用 -newer 选项来查找比其他文件更新的文件。 + +``` +$ find . -newer dig1 -ls + 786434 68 drwxr-xr-x 67 shs shs 69632 Feb 16 19:05 . + 1064442 4 drwxr-xr-x 5 shs shs 4096 Feb 16 11:06 ./snap/cheat + 791846 4 -rw-rw-r-- 1 shs shs 649 Feb 13 14:26 ./dig +``` + +没有相应的 **-older** 选项,但是你可以用**,得到类似的结果 **! -newer**(即更旧),这意味着几乎相同的事情。 + +### 按类型查找文件 + +通过文件类型找到一个文件,你有很多选项——常规文件、目录、块和字符文件等等。以下是文件类型选项列表: + +``` +b block (buffered) special +c character (unbuffered) special +d directory +p named pipe (FIFO) +f regular file +l symbolic link +s socket +``` + +这里有一个寻找符号链接的例子: + +``` +$ find . -type l -ls + 805717 0 lrwxrwxrwx 1 shs shs 11 Apr 10 2019 ./volcano -> volcano.pdf + 918552 0 lrwxrwxrwx 1 shs shs 1 Jun 16 2018 ./letter -> pers/letter2mom +``` + +### 限制查找的深度 + +**-mindepth** 和 **-maxdepth** 选项控制在文件系统中搜索的深度(从当前位置或起始点开始)。 + +``` +$ find -maxdepth 3 -name "*loop" +./bin/save/oldloop +./bin/long-loop +./private/loop +``` + +### 查找空文件 + +在这个命令中,我们寻找空文件,但不超过目录及其子目录。 + +``` +$ find . -maxdepth 2 -empty -type f -ls + 917517 0 -rw-rw-r-- 1 shs shs 0 Sep 23 11:00 ./complaints/newfile + 792050 0 -rw-rw-r-- 1 shs shs 0 Oct 4 19:02 ./junk +``` + +### 按权限查找文件 + +你可以使用 **-perm** 选项查找具有特定权限集的文件。在下面的示例中,我们只查找常规文件(**-type f**),以避免看到默认情况下被赋予这些权限的符号链接,即使它们引用的文件是受限的。 + +``` +$ find -perm 777 -type f -ls +find: ‘./.dbus’: Permission denied + 798748 4 -rwxrwxrwx 1 shs shs 15 Mar 28 2019 ./runme +``` + +### 使用查找来帮助你删除文件 + +如果使用如下命令,你可以使用 find 命令定位并删除文件: + +``` +$ find . -name runme -exec rm {} \; +``` + +{} 代表根据搜索条件找到的每个文件的名称。 + +一个非常有用的选项是将 **-exec** 替换为 **-ok**。当您这样做时,**find** 会在删除任何文件之前要求确认。 + +``` +$ find . -name runme -ok rm -rf {} \; +< rm ... ./bin/runme > ? +``` + +删除文件并不是 **-ok** 和 **-rm** 能为你做的唯一事情。例如,你可以复制、重命名或移动文件。 + +确实有很多选择可以有效地使用 find 命令,毫无疑问还有一些在本文中没有涉及到。我希望你已经找到一些新的,特别有帮助的。 + +加入[Facebook][3]和[LinkedIn][4]上的网络世界社区,评论最热门的话题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3527420/how-to-find-what-you-re-looking-for-on-linux-with-find.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[校对者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/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From ed2ab44e7c059405853af1f2bb78e17d23bd2bc3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Mar 2020 19:36:46 +0800 Subject: [PATCH 203/260] APL --- ...ux Aims to Bring Console Gaming Experience on the Desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md b/sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md index 5cd5c57024..95566050a5 100644 --- a/sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md +++ b/sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 17c0d8fac6bcc18dc2b64d3edf8beece18a273ab Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Mar 2020 20:56:42 +0800 Subject: [PATCH 204/260] TSL --- ...onsole Gaming Experience on the Desktop.md | 139 ------------------ ...onsole Gaming Experience on the Desktop.md | 131 +++++++++++++++++ 2 files changed, 131 insertions(+), 139 deletions(-) delete mode 100644 sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md create mode 100644 translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md diff --git a/sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md b/sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md deleted file mode 100644 index 95566050a5..0000000000 --- a/sources/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md +++ /dev/null @@ -1,139 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop) -[#]: via: (https://itsfoss.com/drauger-os/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop -====== - -For years (or decades) people complained that one of the reasons to not [use Linux][1] is lack of mainstream games. [Gaming on Linux][2] has improved drastically in last few years specially with the [introduction of Steam Proton][3] project that enables you to [play a lot of Windows-only games on Linux][4]. - -This also has encourages several [Linux distributions centered around gaming][5]. Take [Lakka][6] for example. You can [turn your old computer into a retro gaming console thanks to Lakka Linux][7]. - -Another such gaming focused Linux distribution is [Draguer OS][8] and we are going to take a look at it today. - -### What is Drauger OS? - -Accord to [the project’s website][9], “Drauger OS is a Linux desktop gaming operating system. It aims to provide a platform for gamers to use where they can get great performance without sacrificing their security. Furthermore, it aims to make it easy for anyone to game, whether they use a keyboard and mouse, or some sort of controller.” - -They stress that Drauger OS is not for everyday use. As such, many of the productivity tools that most other distros come with are not in Drauger OS. - -![Drauger OS 7.4.1][10] - -Drauger OS is [based][9] on the Ubuntu. The current version (7.4.1 Jiangshi) uses “[Liquorix][11] low latency Linux kernel, a pre-compiled ZEN kernel designed with a balance between latency and throughput in mind”. However, that will be changing in the next release. They only have one desktop environment choice, a modified version of [Xfce][12]. - -Drauger OS has several applications and tools installed out of the box to improve the gaming experience. These include: - - * [PlayOnLinux][13] - * WINE - * [Lutris][14] - * Steam - * [DXVK][15] - - - -It also has an interesting set of tools that are not gaming related. [Drauger Installer][16] is a .deb installer and alternative to Gdebi. [Multiple Repository App Installer][17] (mrai) is “an AUR-helper-like script for Debian-based Linux Operating Systems”. Mrai is designed to work with apt, snaps, flatpaks, and can install apps from GitHub. - -Interestingly, Drauger OS’ name is an error. Lead dev [Thomas Castleman][18] (aka batcastle) has intended to name his distro Draugr, but had mistyped the name. In [episode 23][19] of the Drauger OS podcast, Castleman said the name will stay misspelled because it would be a lot of work to correct it. According to [Wikipedia][20], a draugr is “an undead creature from Norse mythology”. - -Yes, you read that correctly. Drauger OS is one of only a few distros that have its own [podcast][21]. When asked about it, Castleman told me that “I wanted to ensure that we had the maximum transparency possible with our community, no matter their circumstances.” Most of the time, the podcast is an audio version of the Drauger OS blog, but sometimes they use it to make an announcement when they don’t have time to write a blog post. - -### The Future for Drauger OS - -![Drauger OS][22] - -The developers behind Druager OS are working on their next major release: 7.5.1. This release will be based on Ubuntu 19.10. There will be three major changes. First, the Liquorix kernel will be [replaced][23] with “a kernel we are building in-house.” This kernel will be based on the Linux Kernel GitHub repository, “so it’s about as vanilla as it gets”. - -The second major change in the new release will a new layout for their desktop. Based on user feedback, they have decided to change it to something that looks more GNOME-like. - -Thirdly, they are dropping SystemBack as their backup tool and installer. They have instead written a new [installer][24] from scratch. - -The Dev team is also working on an [ARM version][25] of Drauger OS. They hope to release it sometime in 2022. - -### System requirements for Draguer OS - -The Drauger OS [system requirements][25] are pretty modest. Keep in mind that Drauger OS will only run on 64-bit systems. - -#### Minimum system requirements - - * CPU: Dual-Core, 1.8GHz, 64-bit processor - * RAM: 1 GB - * Storage: 16 GB - * Graphics Processor: Integrated - * Screen Resolution: 1024×768 at 60Hz - * External Ports: 1 Port for Display (HDMI / DisplayPort / VGA / DVI), 2 USB Ports for Installation USB Drive and Keyboard (Mouse optional, but recommended) - - - -#### Recommended system requirements - - * CPU: Quad-Core, 2.2Ghz, 64-bit processor - * RAM: 4 GB - * Storage: 128 GB - * Graphics Processor: NVIDIA GTX 1050, AMD RX 460, or equivalent card - * Screen Resolution: 1080p at 60Hz - * External Ports: 1 Port for Display (HDMI / DisplayPort / VGA / DVI), 3 USB Ports for Installation USB Drive, Keyboard, and Mouse, 1 Audio Out Port - - - -### How you can help out Drauger OS - -There are several ways that you can help out the Drauger OS if you are interestedin doing so. They are always looking for [financial support][26] to keep development going. - -If you want yo contribute code, they are looking for people with experience in BASH, C++, and Python. All of their code is up on [GitHub][27]. You can also [contact][28] them on social media. - -### Final Thoughts - -Drauger OS is quite a project. I’ve seen a couple of other [gaming-oriented distributions][29], but Drauger OS is single-minded in its focus on gaming. Since I am more of a casual gamer, this distro doesn’t appeal to me personally. But, I can see how it could lure gaming enthusiasts to Linux. I wish them good luck in their future releases. - -What are your thoughts on this gaming-only distro? What is your favorite Linux gaming solution? Please 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][30]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/drauger-os/ - -作者:[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://itsfoss.com/why-use-linux/ -[2]: https://itsfoss.com/linux-gaming-guide/ -[3]: https://itsfoss.com/steam-play-proton/ -[4]: https://itsfoss.com/steam-play/ -[5]: https://itsfoss.com/linux-gaming-distributions/ -[6]: http://www.lakka.tv/ -[7]: https://itsfoss.com/lakka-retrogaming-linux/ -[8]: https://draugeros.org/go/ -[9]: https://www.draugeros.org/go/about/ -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/drauger-os-7.4.1.jpg?ssl=1 -[11]: https://liquorix.net/ -[12]: https://www.xfce.org/ -[13]: https://www.playonlinux.com/en/ -[14]: https://lutris.net/ -[15]: https://github.com/doitsujin/dxvk -[16]: https://github.com/drauger-os-development/drauger-installer -[17]: https://github.com/drauger-os-development/mrai -[18]: https://github.com/Batcastle -[19]: https://anchor.fm/drauger-os/episodes/Episode-23-eapu47 -[20]: https://en.wikipedia.org/wiki/Draugr -[21]: https://anchor.fm/drauger-os -[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/drauger-os-7.5.1.png?ssl=1 -[23]: https://www.draugeros.org/go/2020/01/20/major-changes-in-drauger-os-7-5-1/ -[24]: https://github.com/drauger-os-development/system-installer -[25]: https://www.draugeros.org/go/system-requirements/ -[26]: https://www.draugeros.org/go/contribute/ -[27]: https://github.com/drauger-os-development -[28]: https://www.draugeros.org/go/contact-us/ -[29]: https://itsfoss.com/manjaro-gaming-linux/ -[30]: https://reddit.com/r/linuxusersgroup diff --git a/translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md b/translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md new file mode 100644 index 0000000000..c8d6710e02 --- /dev/null +++ b/translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop) +[#]: via: (https://itsfoss.com/drauger-os/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Drauger OS Linux 旨在为台式机带来主机游戏体验 +====== + +多年来(或数十年),人们抱怨不[使用Linux][1] 的原因之一是缺乏主流游戏。[Linux 上的游戏][2]在最近几年有了显著改进,特别是 [Steam Proton][3] 项目的引入使你可以[在 Linux 上玩很多 Windows 专用的游戏][4]。 + +这也鼓励了一些[以游戏为中心的 Linux发行版][5]。以 [Lakka][6] 为例,你可以[借助 Lakka Linux 将旧计算机变成复古的街机游戏机][7]。 + +另一个以游戏为中心的 Linux 发行版是 [Draguer OS][8],我们今天将对其进行研究。 + +### Drauger OS + +根据[该项目的网站][9],“Drauger OS 是 Linux 桌面游戏操作系统。它旨在为游戏玩家提供一个平台,使他们可以在不牺牲安全性的情况下获得出色的性能。此外,它旨在使任何人都可以轻松玩游戏,无论他们使用键盘和鼠标还是某种控制器。” + +他们强调 Drauger OS 并非供日常使用。因此,大多数其他发行版附带的许多生产力工具都不在 Drauger OS 中。 + +![Drauger OS 7.4.1][10] + +Drauger OS [基于][9] Ubuntu 之上。当前版本(7.4.1 Jiangshi)使用 “[Liquorix][11] 低延迟Linux 内核,这是一种预编译的 ZEN 内核,设计时考虑了延迟和吞吐量之间的平衡”。但是,这将在下一版本中更改。他们只有一个桌面环境可供选择,即一个修改版本的 [Xfce][12]。 + +Drauger OS 开箱即用地安装了多个应用程序和工具,以改善游戏体验。这些包括: + +* [PlayOnLinux][13] +* WINE +* [Lutris][14] +* Steam +* [DXVK][15] + +它还具有一组与游戏无关的有趣工具。[Drauger Installer][16] 是 .deb 安装程序,是 Gdebi 的替代品。[多软件库应用安装器][17](mrai)是“用于基于 Debian 的 Linux 操作系统的类似于 AUR-helper 的脚本”。Mrai 旨在与 apt、snap、flatpaks 配合使用,并且可以从 GitHub 安装应用程序。 + +有趣的是,Drauger OS 的名称是一个错误。首席开发者 [Thomas Castleman][18](即 batcastle)曾打算为其发行版命名为 Draugr,但是却打错了名字。在 Drauger OS 播客的[第 23 集][19]中,Castleman 说保持这个拼写错误的名称,因为要对其进行更正需要大量工作。根据 [Wikipedia][20] 的描述,Draugr 是“来自北欧神话中的不死生物”。 + +是的,你没看错。Drauger OS 是仅有的几个具有自己的[播客][21]的发行版之一。当被问到这个问题时,Castleman 告诉我:“无论他们的情况如何,我都希望确保我们的社区拥有最大的透明度。”多数情况下,播客是 Drauger OS 博客的音频版本,但有时他们会在没有时间撰写博客文章时使用它来发布公告。 + +### Drauger OS 的未来 + +![Drauger OS][22] + +Druager OS 背后的开发人员正在开发其下一个主要版本:7.5.1。此版本将基于 Ubuntu 19.10。将有三个主要变化。首先,将使用“我们内部构建的内核” [替换][23] Liquorix 内核。该内核将基于 Linux Kernel GitHub 存储库,“因此,它变得越来越原汁原味”。 + +新版本的第二个主要变化将是为其桌面提供新布局。根据用户的反馈,他们决定将其更改为看起来更类似于 GNOME 的样子。 + +第三,他们放弃了 SystemBack 作为其备份工具和安装程序。相反,他们从头开始编写了新的[安装程序][24]。 + +开发团队也正在研究 Drauger OS 的 [ARM 版本][25]。他们希望在 2022 年的某个时候发布它。 + +### 系统要求 + +Drauger OS [系统要求][25]非常适中。请记住,Drauger OS 仅在 64 位系统上运行。 + +#### 最低系统要求 + +* CPU:双核、1.8GHz、64 位处理器 +* RAM:1 GB +* 储存空间:16 GB +* 图形处理器:集成 +* 屏幕分辨率:60Hz 时为 1024×768 +* 外部端口:1 个用于显示的端口(HDMI/DisplayPort/VGA/DVI),2 个用于安装 USB 驱动器和键盘的 USB 端口(鼠标可选,但建议使用) +   +#### 推荐系统要求 + +* CPU:四核、2.2Ghz、64 位处理器 +* RAM:4 GB +* 储存空间:128 GB +* 图形处理器:NVIDIA GTX 1050、AMD RX 460 或同等显卡 +* 屏幕分辨率:60Hz 时为 1080p +* 外部端口:1 个用于显示的端口(HDMI/DisplayPort/VGA/DVI),3 个用于安装 USB 驱动器、键盘和鼠标的 USB 端口,1 个音频输出端口 + +### 如何为Drauger OS提供帮助 + +如果你有兴趣,可以通过多种方法来帮助 Drauger OS。他们一直在寻找[财政支持][26]以保持发展。 + +如果你想贡献代码,他们正在寻找具有 BASH、C++ 和 Python 经验的人员。他们所有的代码都在 [GitHub][27] 上。你也可以在社交媒体上[联系][28]他们。 + +### 结语 + +Drauger OS 只是这类项目之一。我还见过其他[面向游戏的发行版][29],但 Drauger OS 在专注于游戏方面一心一意。由于我更喜欢休闲游戏,因此该发行版对我个人而言并不具有吸引力。但是,我可以看到它如何吸引游戏爱好者使用 Linux。祝他们在以后的发行中好运。 + +你对这个仅限于游戏的发行版有何想法?你最喜欢的 Linux 游戏解决方案是什么?请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/drauger-os/ + +作者:[John Paul][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://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/why-use-linux/ +[2]: https://itsfoss.com/linux-gaming-guide/ +[3]: https://itsfoss.com/steam-play-proton/ +[4]: https://itsfoss.com/steam-play/ +[5]: https://itsfoss.com/linux-gaming-distributions/ +[6]: http://www.lakka.tv/ +[7]: https://itsfoss.com/lakka-retrogaming-linux/ +[8]: https://draugeros.org/go/ +[9]: https://www.draugeros.org/go/about/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/drauger-os-7.4.1.jpg?ssl=1 +[11]: https://liquorix.net/ +[12]: https://www.xfce.org/ +[13]: https://www.playonlinux.com/en/ +[14]: https://lutris.net/ +[15]: https://github.com/doitsujin/dxvk +[16]: https://github.com/drauger-os-development/drauger-installer +[17]: https://github.com/drauger-os-development/mrai +[18]: https://github.com/Batcastle +[19]: https://anchor.fm/drauger-os/episodes/Episode-23-eapu47 +[20]: https://en.wikipedia.org/wiki/Draugr +[21]: https://anchor.fm/drauger-os +[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/drauger-os-7.5.1.png?ssl=1 +[23]: https://www.draugeros.org/go/2020/01/20/major-changes-in-drauger-os-7-5-1/ +[24]: https://github.com/drauger-os-development/system-installer +[25]: https://www.draugeros.org/go/system-requirements/ +[26]: https://www.draugeros.org/go/contribute/ +[27]: https://github.com/drauger-os-development +[28]: https://www.draugeros.org/go/contact-us/ +[29]: https://itsfoss.com/manjaro-gaming-linux/ +[30]: https://reddit.com/r/linuxusersgroup From aee1eebca76a0f90aa16ce7565eece098e2b2c2f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Mar 2020 01:05:14 +0800 Subject: [PATCH 205/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200305=20Instal?= =?UTF-8?q?l=20and=20Use=20Wireshark=20on=20Ubuntu=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200305 Install and Use Wireshark on Ubuntu Linux.md --- ...stall and Use Wireshark on Ubuntu Linux.md | 219 ++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 sources/tech/20200305 Install and Use Wireshark on Ubuntu Linux.md diff --git a/sources/tech/20200305 Install and Use Wireshark on Ubuntu Linux.md b/sources/tech/20200305 Install and Use Wireshark on Ubuntu Linux.md new file mode 100644 index 0000000000..3b0a4f6468 --- /dev/null +++ b/sources/tech/20200305 Install and Use Wireshark on Ubuntu Linux.md @@ -0,0 +1,219 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Install and Use Wireshark on Ubuntu Linux) +[#]: via: (https://itsfoss.com/install-wireshark-ubuntu/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +Install and Use Wireshark on Ubuntu Linux +====== + +_**Brief: You’ll learn to install the latest Wireshark on Ubuntu and other Ubuntu-based distribution in this tutorial. You’ll also learn how to run Wireshark without sudo and how to set it up for packet sniffing.**_ + +[Wireshark][1] is a free and open-source network protocol analyzer widely used around the globe. + +With Wireshark, you can capture incoming and outgoing packets of a network in real-time and use it for network troubleshooting, packet analysis, software and communication protocol development, and many more. + +It is available on all major desktop operating systems like Windows, Linux, macOS, BSD and more. + +In this tutorial, I will guide you to install Wireshark on Ubuntu and other Ubuntu-based distributions. I’ll also show a little about setting up and configuring Wireshark to capture packets. + +### Installing Wireshark on Ubuntu based Linux distributions + +![][2] + +Wireshark is available on all major Linux distributions. You should check out the [official installation instructions][3]. because in this tutorial, I’ll focus on installing the latest Wireshark version on Ubuntu-based distributions only. + +Wireshark is available in the Universe repository of Ubuntu. You can [enable universe repository][4] and then install it like this: + +``` +sudo add-apt-repository universe +sudo apt install wireshark +``` + +One slight problem in this approach is that you might not always get the latest version of Wireshark. + +For example, in Ubuntu 18.04, if you [use the apt command][5] to check the available version of Wireshark, it is 2.6. + +``` +[email protected]:~$ apt show wireshark +Package: wireshark +Version: 2.6.10-1~ubuntu18.04.0 +Priority: optional +Section: universe/net +Origin: Ubuntu +Maintainer: Balint Reczey <[email protected]> +``` + +However, [Wireshark 3.2 stable version][6] has been released months ago. New release brings new features, of course. + +So, what do you do in such case? Thankfully, Wiresshark developers provide an official PPA that you can use to install the latest stable version of Wireshark on Ubuntu and other Ubuntu-based distributions. + +I hope you are acquainted with PPA. If not, please [read our excellent guide on PPA to understand it completely][7]. + +Open a terminal and use the following commands one by one: + +``` +sudo add-apt-repository ppa:wireshark-dev/stable +sudo apt update +sudo apt install wireshark +``` + +Even if you have an older version of Wireshark installed, it will be updated to the newer version. + +While installing, you will be asked whether to allow non-superusers to capture packets. Select Yes to allow and No to restrict non-superusers to capture packets & finish the installation. + +### Running Wireshark without sudo + +If you have selected **No** in the previous installation, then run the following command as root: + +``` +sudo dpkg-reconfigure wireshark-common +``` + +And select **Yes** by pressing the tab key and then using enter key: + +![][8] + +Since you have allowed the non-superuser to capture packets, you have to add the user to wireshark group. Use the [usermod command][9] to add yourself to the wireshark group. + +``` +sudo usermod -aG wireshark $(whoami) +``` + +Finally, [restart your Ubuntu system][10] to make the necessary changes to your system. + +Trivia + +First released in 1998, Wireshark was initially known as Ethereal. Developers had to change its name to Wireshark in 2006 due to trademark issues. + +### Starting Wireshark + +Launching Wireshark application can be done from the application launcher or the CLI. + +To start from CLI, just type **wireshark** on your console: + +``` +wireshark +``` + +From **GUI**, search for Wireshark application on the search bar and hit enter. + +![][11] + +Now let’s play with Wireshark. + +### Capturing packets using Wireshark + +When you start Wireshark, you will see a list of interfaces that you can use to capture packets to and from. + +There are many types of interfaces available which you can monitor using Wireshark such as, Wired, External devices, etc. According to your preference, you can choose to show specific types of interfaces in the welcome screen from the marked area in the given image below. + +![Select interface][12] + +For instance, I listed only the **Wired** network interfaces. + +![][13] + +Next, to start capturing packets, you have to select the interface (which in my case is ens33) and click on the **Start capturing packets** icon as marked in the image below. + +![Start capturing packets with Wireshark][14] + +You can also capture packets to and from multiple interfaces at the same time. Just press and hold the **CTRL** button while clicking on the interfaces that you want to capture to and from and then hit the **Start capturing packets** icon as marked in the image below. + +![][15] + +Next, I tried using **ping google.com** command in the terminal and as you can see, many packets were captured. + +![Captured packets][16] + +Now you can select on any packet to check that particular packet. After clicking on a particular packet you can see the information about different layers of TCP/IP Protocol associated with it. + +![Packet info][17] + +You can also see the RAW data of that particular packet at the bottom as shown in the image below. + +![Check RAW data in the captured packets][18] + +This is why end-to-end encryption is important + +Imagine you are logging into a website that doesn’t use HTTPS. Anyone on the same network as you can sniff the packets and see the user name and password in the RAW data. +This is why most chat applications use end to end encryption and most websites these days use https (instead of http). + +#### Stopping packet capture in Wireshark + +You can click on the red icon as marked in the given image to stop capturing Wireshark packets. + +![Stop packet capture in Wireshark][19] + +#### Save captured packets to a file + +You can click on the marked icon in the image below to save captured packets to a file for future use. + +![Save captured packets by Wireshark][20] + +**Note**: _Output can be exported to XML, PostScript®, CSV, or plain text._ + +Next, select a destination folder, and type the file name and click on **Save**. +Then select the file and click on **Open**. + +![][21] + +Now you can open and analyze the saved packets anytime. To open the file, press **\ + o** +or go to **File > Open** from Wireshark. + +The captured packets should be loaded from the file. + +![][22] + +### Conclusion + +Wireshark supports many different communication protocols. There are many options and features that provide you the power to capture and analyze the network packets in a unique way. You can learn more about Wireshark from their [official documentation][23]. + +I hope this detailed helped you to install Wireshark on Ubuntu. Please let me know your questions and suggestions. + +![][24] + +### Kushal Rai + +A computer science student & Linux and open source lover. He likes sharing knowledge for he believes technology shapes the perception of modern world. Kushal also loves music and photography. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-wireshark-ubuntu/ + +作者:[Community][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/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://www.wireshark.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/wireshark_ubuntu.png?ssl=1 +[3]: https://www.wireshark.org/docs/wsug_html_chunked/ChBuildInstallUnixInstallBins.html +[4]: https://itsfoss.com/ubuntu-repositories/ +[5]: https://itsfoss.com/apt-command-guide/ +[6]: https://www.wireshark.org/news/20191218.html +[7]: https://itsfoss.com/ppa-guide/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/yes.png?ssl=1 +[9]: https://linuxhandbook.com/usermod-command/ +[10]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/wire.png?ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/interfaces.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/intoption.jpg?ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/singleinterface.jpg?ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/selint.jpg?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/capture.jpg?ssl=1 +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/packetinfo.png?ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/raw.png?ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/stopcapture.png?ssl=1 +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/savepackets.jpg?ssl=1 +[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/savename.jpg?ssl=1 +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/openpacket.png?ssl=1 +[23]: https://www.wireshark.org/docs/https://www.wireshark.org/docs/ +[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/kushal_rai.jpg?ssl=1 From 8a284e908dae7d6a92202233a65bd00d86e323b9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Mar 2020 01:07:52 +0800 Subject: [PATCH 206/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200304=20How=20?= =?UTF-8?q?service=20virtualization=20relates=20to=20test-driven=20develop?= =?UTF-8?q?ment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200304 How service virtualization relates to test-driven development.md --- ...tion relates to test-driven development.md | 428 ++++++++++++++++++ 1 file changed, 428 insertions(+) create mode 100644 sources/tech/20200304 How service virtualization relates to test-driven development.md diff --git a/sources/tech/20200304 How service virtualization relates to test-driven development.md b/sources/tech/20200304 How service virtualization relates to test-driven development.md new file mode 100644 index 0000000000..4ff4243603 --- /dev/null +++ b/sources/tech/20200304 How service virtualization relates to test-driven development.md @@ -0,0 +1,428 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How service virtualization relates to test-driven development) +[#]: via: (https://opensource.com/article/20/3/service-virtualization-test-driven-development) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +How service virtualization relates to test-driven development +====== +Mountebank simulates services you're dependent on so autonomous teams +can continue development activities without having to wait on anyone. +![Person using a laptop][1] + +The agile approach to software development relies on service virtualization to give each IT team autonomy. This approach removes blockages and allows autonomous teams to continue development activities without having to wait on anyone. That way, integration testing can commence as soon as teams start iterating/sprinting. + +### How automated services work + +Any automated service is available to consumers via a published endpoint. This means services can be automated only if they're made available online. + +Any consumer wishing to leverage available automated services must be capable of sending requests to that service's endpoint via an HTTP protocol. Some of those services will, upon receiving the request via the HTTP protocol, respond by simply sending back some data. Other services may respond to receiving a request via HTTP protocol by actually performing some work. For example, a service may create a resource (for example, create an order), update a resource (update an order), or delete a resource (cancel an order). + +All those activities get triggered via the HTTP protocol. In the simplest of cases, the action instigated by the service consumer is GET (e.g., HTTP GET). That request may arrive with some query values; those values will get used by the service to narrow down the search (such as "search for order number 12345 and return the data"). + +In more elaborate cases, a request may arrive with the instruction to POST some values; a service will accept that request and expect some values to be associated with it. Those values are usually called the payload. When the service accepts an HTTP POST request containing the payload, it will attempt to process it. It may or may not succeed in processing it, but either way, it will respond to the service consumer with a status code and an optional status message. That way, service consumers will be notified of the success/failure of their request so that they can decide what the next step should be. + +### What is service virtualization? + +Now that we understand how automated services work, it should be easier to understand how to virtualize them. In a nutshell, it is possible to simulate any service that is published on a hosting site. Instead of sending HTTP requests directly to the service provider's endpoint, you can interject a fake, pretend service that simulates the behavior of the real service. + +From the service consumer's standpoint, it makes absolutely no difference whether it is interacting with a real or a fake service. The interaction remains identical. + +### Virtualize one service + +OK, enough talking, I'll roll up my sleeves and show how to do it in practical terms. Suppose your team is starting a new project and receives requirements in the form of a fully fleshed user story: + +#### Authenticate user + +_As a new app_ +_I want to authenticate the user_ +_Because we want to ensure proper security for the app_ + +#### Acceptance criteria + +**Scenario #1:** _New app successfully authenticates the user_ +Given that the user has navigated to the login page +And the user has submitted credentials +When new app receives login request +Then new app successfully authenticates the user +And new app displays response message "User successfully logged in." + +**Scenario #2:** _New app cannot authenticate the user on the first attempt_ +Given that the user has navigated to the login page +And the user has submitted credentials +When new app receives login request +Then new app fails to successfully authenticate the user +And new app displays response message "Incorrect login. You have 2 more attempts left." + +**Scenario #3:** _New app cannot authenticate the user on the second attempt_ +Given that the user has navigated to the login page +And the user has submitted credentials +When new app receives login request +Then new app fails to successfully authenticate the user +And new app displays response message "Incorrect login. You have 1 more attempt left." + +**Scenario #4:** _New app cannot authenticate the user on the third attempt_ +Given that the user has navigated to the login page +And the user has submitted credentials +When new app receives login request +Then new app fails to successfully authenticate the user +And new app displays response message "Incorrect login. You have no more attempts left." + +The first thing to do when starting the work on this user story is to create the so-called "walking skeleton" (for this exercise, I will be using the standard **.Net Core** platform plus **xUnit.net** I discussed in my previous articles ([starting with this one][2] with [another example here][3]). Please refer to them for technical details on how to install, configure, and run the required tools. + +Create the walking skeleton infrastructure by opening the command line and typing: + + +``` +`mkdir AuthenticateUser` +``` + +Then move inside the **AuthenticateUser** folder: + + +``` +`cd AuthenticateUser` +``` + +And create a separate folder for tests: + + +``` +`mkdir tests` +``` + +Move into the **tests** folder (**cd tests**) and initiate the **xUnit** framework: + + +``` +`dotnet new xunit` +``` + +Now move one folder up (back to **AuthenticateUser**) and create the app folder: + + +``` +mkdir app +cd app +``` + +Create the scaffold necessary for C# code: + + +``` +`dotnet new classlib` +``` + +The walking skeleton is now ready! Open the editor of your choice and start coding. + +### Write a failing test first + +In the spirit of TDD, start by writing the failing test (refer to the [previous article][4] to learn why is it important to see your test fail before attempting to make it pass): + + +``` +using System; +using Xunit; +using app; + +namespace tests { +    public class UnitTest1 { +        Authenticate auth = [new][5] Authenticate(); + +        [Fact] +        public void SuccessLogin(){ +            var given = "credentials"; +            var expected = "Successful login."; +            var actual = auth.Login(given); +            Assert.Equal(expected, actual); +        } +    } +} +``` + +This test states that if someone supplies some credentials (i.e., a secret username and password) to the **Login** method of the **Authenticate** component when it processes the request, it is expected to return the message "Successful login." + +Of course, this is functionality that does not exist yet—the instantiated **Authenticate** module in the **SuccessLogin()** module hasn't been written yet. So you might as well go ahead and take the first stab at writing the desired functionality. Create a new file (**Authenticate.cs**) in the **app** folder and add the following code: + + +``` +using System; + +namespace app { +    public class Authenticate { +        public string Login(string credentials) { +            return "Not implemented"; +        } +    } +} +``` + +Now, navigate to the **tests** folder and run: + + +``` +`dotnet test` +``` + +![Output of dotnet.test][6] + +The test fails because it was expecting a "Successful login" output but instead got the "Not implemented" output. + +### Increasing complexity for day two operations + +Now that you have created the "happy path" expectation and made it fail, it is time to work on implementing the functionality that will make the failing test pass. The following day, you attend the standup and report that you have started on the "Authenticate user" story. You let the team know that you have created the first failing test for the "happy path," and today, the plan is to implement the code to make the failing test pass. + +You explain your intention to first create a **User** table containing the **username**, **password**, and other pertinent attributes. But the scrum master interrupts and explains that the **User** module is being handled by another team. It would be bad practice to duplicate the maintenance of users, as the information will quickly get out of sync. So instead of building the **User** module (which would include the authentication logic), you are to leverage the authentication services that the **User** team is working on. + +That's great news because it saves you the trouble of having to write a lot of code to implement the **User** processing. Emboldened, you enthusiastically announce that you will quickly cobble up a function that will take user credentials and send them to the service that the **User** team has built. + +Alas, your intentions get squashed again as you learn that the **User** team hasn't started building the **User authentication** service yet. They're still in the process of assigning user stories to the backlog. Disheartened, you resign to the fact that it will be at least a few days (if not weeks?) before you can start working on the **User authentication** story. + +The scrum master then says that there is no reason to wait for the **User authentication** service to be built and deployed to testing. You could start developing the authentication functionality right away. But how can you do that? + +The scrum master offers a simple suggestion: leverage service virtualization. Since all specifications for the **User** module have been solidified and signed off, you have a solid, non-volatile contract to build your solution against. The contract published by the **User** services team states that in order to authenticate a user, specific expectations must be fulfilled: + + 1. A client wishing to authenticate a user should send an **HTTP POST** request to the endpoint . + 2. The **HTTP POST** sent to the above endpoint must have a **JSON** payload that contains the user credentials (i.e., username and password). + 3. Upon receiving the request, the service will attempt to log the user in. If the username and password match the information on record, the service will return an **HTTP** response containing status code 200 with the body of the response containing the message "User successfully logged in." + + + +So, now that you know the contract details, you can start building the solution. Here's the code that connects to the endpoint, sends the **HTTP POST** request, and receives the **HTTP** response: + + +``` +using System; +using System.Net.Http; +using System.Threading.Tasks; +using System.Collections.Generic; + +namespace app { +    public class Authenticate { +        HttpClient client = [new][5] HttpClient(); +        string endPoint = ""; + +        public string Login(string credentials) { +            Task<string> response = CheckLogin(credentials); +            return response.Result; +        } + +        private async Task<string> CheckLogin(string credentials) { +            var values = [new][5] Dictionary<string, string>{{"credentials", credentials}}; +            var content = [new][5] FormUrlEncodedContent(values); +            var response = await client.PostAsync(endPoint, content); +            return await response.Content.ReadAsStringAsync(); +        } +    } +} +``` + +This code won't work because does not exist (yet). Are you stuck now, waiting for the other team to eventually build and deploy that service? + +Not really. Service virtualization to rescue! Let's pretend that the service is already there and continue the development. + +### How to virtualize a service + +One way to virtualize the **User authentication** service would be to write a new app (the new API) and run it locally. This API will mirror the contract specified by the real **User authentication** API and will only return hard-coded stubbed data (it will be a fake service). + +Sounds like a good plan. Again, the team pushes back during the standup, questioning the need for writing, building, testing, and deploying a brand new app just to accomplish this fake functionality. It kind of wouldn't be worth the trouble because, by the time you deliver that new fake app, the other team would probably be ready with the real service. + +So you've reached an impasse. It looks like you are forced to wait on your dependency to materialize. You've failed to control your dependencies; you now have no recourse but to work in a sequential fashion. + +Not so fast! There is a great new tool called [mountebank][7] that is ideal for virtualizing any service. Using this tool, you can quickly stand up a local server that listens on a port you specify and takes orders. To make it simulate a service, you only have to tell it which port to listen to and which protocol to handle. The choice of protocols is: + + * HTTP + * HTTPS + * SMTP + * TCP + + + +In this case, you need the HTTP protocol. First, install mountebank—if you have **npm** on your computer, you can simply type on the command line: + + +``` +`npm install -g mountebank` +``` + +After it's installed, run mountebank by typing: + + +``` +`mb` +``` + +At startup, mountebank will show: + +![mountebank startup][8] + +Now you're ready to virtualize an HTTP service. In this case, the **User authentication** service expects to receive an HTTP POST request; here is how the implemented code sends an HTTP POST request: + + +``` +`var response = await client.PostAsync(endPoint, content);` +``` + +You now have to establish that **endPoint**. Ideally, all virtualized services should be propped in the **localhost** server to ensure quick execution of integration tests. + +To do that, you need to configure the **imposter**. In its bare-bones form, the **imposter** is a simple JSON collection of key-value pairs containing the definition of a port and a protocol: + + +``` +{ +    "port": 3001, +    "protocol": "http" +} +``` + +This imposter is configured to handle the HTTP protocol and to listen to incoming requests on port 3001. + +Just listening to incoming HTTP requests on port 3001 is not going to do much. Once the request arrives at that port, mountebank needs to be told what to do with that request. In other words, you are virtualizing not only the availability of a service on a specific port but also the way that virtualized service is going to respond to the request. + +To accomplish that level of service virtualization, you need to tell mountebank how to configure stubs. Each stub consists of two components: + + 1. A collection of predicates + 2. A collection of expected responses + + + +A predicate (sometimes called a matcher) narrows down the scope of the incoming request. For example, using the HTTP protocol, you can expect more than one type of method (e.g., GET, POST, PUT, DELETE, PATCH, etc.). In most service-virtualization scenarios, we are interested in simulating the behavior that is specific to a particular HTTP method. This scenario is about responding to the HTTP POST request, so you need to configure your stub to match on HTTP POST requests only: + + +``` +{ +    "port": 3001, +    "protocol": "http", +    "stubs": [ +        { +            "predicates": [ +                { +                    "equals": { +                        "method": "post" +                    } +                } +            ] +        } +    ] +} +``` + +This imposter defines one predicate that matches (using the keyword **equals**) on the HTTP POST request only. + +Now take a closer look at the **endPoint** value, as defined in the implemented code: + + +``` +`string endPoint = "http://localhost:3001/api/v1/users/login";` +``` + +In addition to listening to port 3001 (as defined in ), the **endPoint** is more specific, in that it expects the incoming HTTP POST request to go to the /api/v1/users/login path. How do you tell mountebank to only match exactly on the /api/v1/users/login path? By adding the path key-value pair to the stub's predicate: + + +``` +{ +    "port": 3001, +    "protocol": "http", +    "stubs": [ +        { +            "predicates": [ +                { +                    "equals": { +                        "method": "post", +                        "path": "/api/v1/users/login" +                    } +                } +            ] +        } +    ] +} +``` + +This imposter now knows that HTTP requests arriving at port 3001 must be a POST method and must point at the /api/v1/users/login path. The only thing left to simulate is the expected HTTP response. + +Add the response to the JSON imposter: + + +``` +{ +    "port": 3001, +    "protocol": "http", +    "stubs": [ +        { +            "predicates": [ +                { +                    "equals": { +                        "method": "post", +                        "path": "/api/v1/users/login" +                    } +                } +            ], +            "responses": [ +                { +                    "is": { +                        "statusCode": 200, +                        "body": "Successful login." +                    } +                } +            ] +        } +    ] +} +``` + +With mountebank imposters, you define responses as a collection of JSON key-value pairs. In most cases, it is sufficient to simply state that a response is a **statusCode** and a **body**. This case is simulating the "happy path" response that has the status code **OK (200)** and the body containing a simple message **Successful login** (as specified in the acceptance criteria). + +### How to run virtualized services? + +OK, now that you have virtualized the **User authentication** service (at least its "happy path"), how do you run it? + +Remember that you have already started mountebank, and it reported that it is running in memory as the domain. Mountebank is listening on port 2525 and taking orders. + +Great, now you have to tell mountebank that you have the imposter ready. How do you do that? Send an HTTP POST request to . The requests body must contain the JSON you created above. There are a few techniques available to send that request. If you're versed in [curl][9], using it to send HTTP POST requests would be the simplest, quickest way to stand up the imposter. But many people prefer a more user-friendly way to send the HTTP POST to mountebank. + +The easy way to do that is to use [Postman][10]. If you download and install Postman, you can point it at , select the POST method from the pulldown menu, and copy and paste the imposter JSON into the raw body. + +When you click Send, the imposter will be created, and you should get Status 201 (Created). + +![Postman output][11] + +Your virtualized service is now running! You can verify it by navigating to the **tests** folder and running the **dotnet test** command: + +![dotnet test output][12] + +### Conclusion + +This demo shows how easy it is to remove blockages and control dependencies by simulating services you're dependent on. Mountebank is a fantastic tool that easily and cheaply simulates all kinds of very elaborate, sophisticated services. + +In this installment, I just had time to illustrate how to virtualize a simple "happy path" service. If you go back to the actual user story, you will notice that its acceptance criteria contain several "less happy" paths (cases when someone is repeatedly trying to log in using invalid credentials). It's a bit trickier to properly virtualize and test those use cases, so I've left that exercise for the next installment in this series. + +How will you use service virtualization to solve your testing needs? I would love to hear about it in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/service-virtualization-test-driven-development + +作者:[Alex Bunardzic][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/alex-bunardzic +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/article/19/8/mutation-testing-evolution-tdd +[3]: https://opensource.com/article/19/9/mutation-testing-example-tdd +[4]: https://opensource.com/article/20/2/automate-unit-tests +[5]: http://www.google.com/search?q=new+msdn.microsoft.com +[6]: https://opensource.com/sites/default/files/uploads/dotnet-test.png (Output of dotnet.test) +[7]: http://www.mbtest.org/ +[8]: https://opensource.com/sites/default/files/uploads/mountebank-startup.png (mountebank startup) +[9]: https://curl.haxx.se/ +[10]: https://www.postman.com/ +[11]: https://opensource.com/sites/default/files/uploads/status-201.png (Postman output) +[12]: https://opensource.com/sites/default/files/uploads/dotnet-test2.png (dotnet test output) From 398dd2ab5afdae764c9c5e30eb42cfc55c2613c4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Mar 2020 01:09:29 +0800 Subject: [PATCH 207/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200304=20Gettin?= =?UTF-8?q?g=20started=20with=20the=20Gutenberg=20editor=20in=20Drupal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md --- ...ted with the Gutenberg editor in Drupal.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md diff --git a/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md b/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md new file mode 100644 index 0000000000..6050adebfa --- /dev/null +++ b/sources/tech/20200304 Getting started with the Gutenberg editor in Drupal.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with the Gutenberg editor in Drupal) +[#]: via: (https://opensource.com/article/20/3/gutenberg-editor-drupal) +[#]: author: (MaciejLukianski https://opensource.com/users/maciejlukianski) + +Getting started with the Gutenberg editor in Drupal +====== +Learn how to use the WYSIWYG editor, made popular in WordPress, with +Drupal. +![Text editor on a browser, in blue][1] + +Since 2017, WordPress has had a really great WYSIWYG editor in the [Gutenberg][2] plugin. But the Drupal community hasn't yet reached consensus on the best approach to the content management system's (CMS) editorial experience. But a strong new option appeared when, with a lot of community effort, [Gutenberg was integrated with Drupal][3]. + +Previously, there were two main approaches to content creation in Drupal 8: + + * In the [**Paragraph-based approach**][4], content is assembled out of entities called paragraphs. Currently, approximately 100,000 websites use the Paragraphs module (according to Drupal). + * The [**Layout-Builder approach**][5] uses an editorial tool shipped with Drupal 8.5. It is still undergoing improvements, but it is the next strong contender because it is really well integrated with the Drupal core. Stats on usage are not available since Layout Builder is part of Drupal. + + + +At the end of 2018, the Drupal community, lead by Fronkom (a Norwegian digital agency strongly focused on open source solutions), ported the WordPress Gutenberg project as a contributed module into Drupal. Let's take a look at how Gutenberg works in Drupal (including some cool Drupal-specific integrations). + +### Installation + +Installing the [Gutenberg module][6] is as straightforward as installing any Drupal module, and it has good [installation documentation][7]. + +### Configuration + +Gutenberg is integrated into Drupal's default content-entity creation workflow. You can use it on any of the content types you choose, provided that the content type has at least one text area field, which is where the Gutenberg editor's output will be saved. + +To enable the Gutenberg project on a content type in Drupal, you have to navigate to its settings: **Structure > Content types** and, from the dropdown next to the content type where you want to use Gutenberg, click **Edit**. + +![Drupal settings][8] + +In the form that appears, scroll down and select the **Gutenberg experience** tab on the left, where you can find the settings described below. Select the **Enable Gutenberg experience** box. + +![Drupal Gutenberg settings][9] + +#### Template + +This is one of the cool features that is not available in WordPress out of the box. It enables you to define a template for a new page in a JSON structure. This will pre-populate all newly created articles with dummy placeholder content, which will help editors structure content correctly. In the screenshot above, I added a heading and a paragraph. Note that any double-quotes have to be escaped. + +#### Template lock + +This setting allows you to define whether users are allowed to delete the placeholder content, add new blocks, or just edit the existing, pre-populated content. + +#### Allowed Gutenberg and Drupal blocks + +This is another super-cool feature on the Drupal side of Gutenberg. Drupal allows users to create various types of blocks to design a page. For example, you could create a block with a list of the five latest blog posts, the most recent comments, or a form to collect users' emails. + +Gutenberg's deep integration with Drupal allows users to select which Drupal blocks are available to users while they are editing (e.g., limit embeds to YouTube) and use blocks as inline content. This is a very handy feature that allows granular control of the user experience. + +There's not much to choose from in a blank Drupal installation, but a live site usually has many blocks that provide various functionalities. In the screenshot below, the **Search form** Drupal block is selected. + +![Drupal Gutenberg blocks][10] + +After you finish the configuration, hit **Save content type**. + +### Publishing content with Drupal Gutenberg + +When Gutenberg is enabled for a content type, it takes over most of the editorial experience. + +![Drupal Gutenberg content screen][11] + +In the main window, you can see the dummy placeholder content I added in the Template configuration above. + +#### Drupal-specific options + +On the right-hand side, there are a few fields and settings that Drupal provides. For example, the **Title** field is a required separate field in Drupal, and therefore it is not on the main Gutenberg screen. + +Underneath the **Title**, there are additional settings that can vary, depending on the modules installed and options set up in Drupal. You can see **Revision log messages**, **Menu settings**, **Comment settings**, and a place to add a **URL alias**. + +Typically, Drupal content types are composed of several text fields, such as tags, categories, checkboxes, image fields for teasers, etc. When you enable Gutenberg for a content type, these additional fields are available in the **More settings** tab. + +You can now add your content—it works the same as it does in WordPress Gutenberg, with the additional option to add Drupal blocks. + +In the screenshot below, you can see what happens when I add some text to replace the placeholder text, a search block from Drupal, a title, tags, and a custom URL alias. + +![Drupal Gutenberg entering text][12] + +After you hit **Save**, your content will be published. + +![Drupal Gutenberg output][13] + +And that is it. It works like a charm! + +### Working together for better software experiences + +Gutenberg in Drupal works well. It is an alternative option that allows editors to control the look and feel of their websites down to the tiniest details. Adoption is growing well, with over 1,000 installations as of this writing and 50 new ones every month. The Drupal integration adds other cool features like fine-grained permissions, placeholder content, and the ability to include Drupal blocks inline, which aren't available in the WordPress plugin. + +It is great to see the communities of two separate projects working together to achieve the common goal of giving people better software. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/gutenberg-editor-drupal + +作者:[MaciejLukianski][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/maciejlukianski +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://wordpress.org/plugins/gutenberg/ +[3]: https://drupalgutenberg.org/ +[4]: https://www.droptica.com/blog/flexible-and-easy-content-creation-drupal-paragraphs-module/ +[5]: https://www.droptica.com/blog/layout-builder-building-drupal-8-layouts/ +[6]: https://www.drupal.org/project/gutenberg +[7]: https://www.drupal.org/docs/8/extending-drupal-8/installing-drupal-8-modules +[8]: https://opensource.com/sites/default/files/uploads/gutenberg_edit.png (Drupal settings) +[9]: https://opensource.com/sites/default/files/uploads/gutenberg_settings.png (Drupal Gutenberg settings) +[10]: https://opensource.com/sites/default/files/uploads/gutenberg_blocks.png (Drupal Gutenberg blocks) +[11]: https://opensource.com/sites/default/files/uploads/gutenberg_contentwindow.png (Drupal Gutenberg content screen) +[12]: https://opensource.com/sites/default/files/uploads/gutenberg_entry.png (Drupal Gutenberg entering text) +[13]: https://opensource.com/sites/default/files/uploads/gutenberg-demo.png (Drupal Gutenberg output) From c813eb3c075a18e26bb944fc3e031d3d4620141e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Mar 2020 01:19:05 +0800 Subject: [PATCH 208/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200304=20Seawat?= =?UTF-8?q?er,=20humidity=20inspire=20new=20ways=20to=20generate=20power?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200304 Seawater, humidity inspire new ways to generate power.md --- ...dity inspire new ways to generate power.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/talk/20200304 Seawater, humidity inspire new ways to generate power.md diff --git a/sources/talk/20200304 Seawater, humidity inspire new ways to generate power.md b/sources/talk/20200304 Seawater, humidity inspire new ways to generate power.md new file mode 100644 index 0000000000..7e2dc5927f --- /dev/null +++ b/sources/talk/20200304 Seawater, humidity inspire new ways to generate power.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Seawater, humidity inspire new ways to generate power) +[#]: via: (https://www.networkworld.com/article/3529893/seawater-humidity-inspire-new-ways-to-generate-power.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Seawater, humidity inspire new ways to generate power +====== +Researchers around the globe are working on new ways to generate huge amounts of power that will be needed for the shift to a data-driven society. +Getty Imags + +The possiblity of a future power-availability crunch – spurred in part by a global increase in data usage – is driving researchers to get creative with a slew of new and modified ways to generate and store energy. + +Ongoing projects include the use of seawater for batteries; grabbing ambient humidity; massive water storage systems for hydropower; and solar panels that work at night. Here are some details: + +### Batteries based on seawater + +Seawater will provide "super-batteries," says the University of Southern Denmark. Researchers there have been studying how to use sodium, which is abundant in seawater, as an alternative to lithium in batteries. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +"Sodium is a very readily available resource," the school says in a [press release][2], and it can be easily extracted from seawater. Lithium, on the other hand, is a limited resource that's mined only in a few places in the world, says research leader Dorthe Bomholdt Ravnsbæk of the department of physics, chemistry and pharmacy at the university. Batteries based on seawater would also alleviate the need for cobalt, which is used in lithium cells. The team in Denmark (working with Massachusetts Institute of Technology) believes it has come up with a new electrode material, based on manganese, that will make the seawater battery ultimately viable. + +### Using ambient moisture to generate power + +Humidity captured with bio-electronics could end up being a viable power source for sensors, say some scientists. + +"Harvesting energy from the environment offers the promise of clean power for self-sustained systems," notes University of Massachusetts researchers [in an article published in Nature][3]. However, known technologies often have restrictive environmental requirements – solar panels that must be mounted outside, for example – that limit their energy-producing potential. + +Moisture harvesting with thin-film, protein nanowires doesn't have restrictive environmental requirements. Sustained voltages of about half a volt can be obtained from moisture present in normal, ambient air. "Connecting several devices linearly scales up the voltage and current to power electronics," the Amherst group claims. "Our results demonstrate the feasibility of a continuous energy-harvesting strategy that is less restricted by location or environmental conditions than other sustainable approaches." + +[][4] + +### Seasonally pumped hydropower storage  + +On a larger scale, inland water storage could solve renewable power issues, say scientists at the International Institute for Applied Systems Analysis. + +One big problem collecting power from the environment, as opposed to using fossil fuels, is where to store the on-the-fly electricity being generated. The Austrian organization believes that hydropower systems should be used to contain renewable energy. It's cheap, for starters. In addition, seasonal pumped hydropower storage (SPHS) is better than wind or solar, the group claims, because it not only generates the power in real time as it’s needed, but also isn't affected by variations— a windy day isn't required, for example. + +SPHS operates by pumping water into dammed, river-adjacent reservoirs when water flow is high but power demand is low. Water is then allowed to flow out of the reservoir, through turbines—similar to hydroelectric—when energy demand increases. Electricity is thus created. The group, in a [press release][5] related to a study just released, says the technique is highly economical, even including required land purchases, excavation and tunneling. + +### Nighttime, anti-solar cells + +Contrary to popular belief, photovoltaic solar panels don't actually need full sun to function. Cloud cover allows some to work just fine, just not as well. Nighttime photovoltaic, however, is something more radical: + +The earth should be used as a heat source, and the night sky a heat sink, say Jeremy Munday and Tristan Deppe of the department of electrical and computer engineering at University of California, Davis. They shared their idea for nighttime photovoltaic cells in an [abstract of a paper][6] published by American Chemical Society's ACS Photonics. + +What they are suggesting is using thermoradiative photovoltaics, where deep space radiative cooling ([which I’ve written about before][7]) is combined with photovoltaics. Current is created as infrared light – or heat, in other words – is radiated into extremely cold, deep space. + +"Similar to the way a normal solar cell works, but in reverse," Munday says of their anti-solar panel concept, quoted in a [UC Davis news article][8].  + +Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3529893/seawater-humidity-inspire-new-ways-to-generate-power.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.sdu.dk/en/nyheder/Forskningsnyheder/skal_fremtidens_superbatterier_laves_af_havvand +[3]: https://www.nature.com/articles/s41586-020-2010-9 +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://iiasa.ac.at/web/home/about/news/200219-seasonal-pumped-storage.html +[6]: https://pubs.acs.org/toc/apchd5/7/1 +[7]: https://www.networkworld.com/article/3222850/space-radiated-cooling-cuts-power-use-21.html +[8]: https://www.ucdavis.edu/news/anti-solar-cells-photovoltaic-cell-works-night +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world From 2be87fcfdcca73633cc7878507786f3fed6043c8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 5 Mar 2020 08:26:00 +0800 Subject: [PATCH 209/260] translated --- ...w to Add New Brushes in GIMP -Quick Tip.md | 105 ------------------ ...w to Add New Brushes in GIMP -Quick Tip.md | 105 ++++++++++++++++++ 2 files changed, 105 insertions(+), 105 deletions(-) delete mode 100644 sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md create mode 100644 translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md diff --git a/sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md b/sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md deleted file mode 100644 index 6a93204805..0000000000 --- a/sources/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md +++ /dev/null @@ -1,105 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Add New Brushes in GIMP [Quick Tip]) -[#]: via: (https://itsfoss.com/add-brushes-gimp/) -[#]: author: (Community https://itsfoss.com/author/itsfoss/) - -How to Add New Brushes in GIMP [Quick Tip] -====== - -[GIMP][1], is the most popular free and open-source image editor and perhaps the best [Adobe Photoshop alternative][2] on Linux. - -When you [install GIMP on Ubuntu][3] or any other operating system, you’ll find a few brushes already installed for basic image editing. If you need something more specific, you can always add new brushes in GIMP. - -How? Let me show you that in this quick tutorial. - -### How to add brushes in GIMP - -![][4] - -There are three steps involved in installing new brushes in GIMP: - - * Get new brush - * Put it in the designated folder - * Refresh the brushes in GIMP - - - -#### Step 1: Download new GIMP brushes - -The first step is to get new brushes for GIMP. Where do you get it from? From the internet, of course. - -You can search on Google or [alternative private search engines like Duck Duck Go][5] for ‘GIMP brushes’ and download the ones you like from a reputed website. - -GIMP brushes are usually available in .gbr and .gih file formats. The .gbr file is for regular brushes while .gih is used for animated brushes. - -Did you know? - -For the versions 2.4 and above, GIMP makes installing and using Photoshop brushes (.abr file) quite straightforward. All you need to do is place the Photoshop brush files in the proper folder. -Do keep in mind that the latest Photoshop brushes might not work with GIMP flawlessly. - -#### Step 2: Copy the new brushes into its location - -After you get your brush file, the next step is to copy and paste it to the right folder in GIMP configuration directory. - -On **Windows**, you’ll have to go to a folder like “**C:\Documents and Settings\myusername.gimp-2.10\brushes**“. - -I’ll show detailed steps for **Linux** because It’s FOSS is a Linux-focused website. - -After selecting the brush files press **Ctrl+h** in your **Home** folder to [see hidden files in Linux][6]. - -![Press Ctrl+H to see hidden files in the home directory][7] - -You should go to **.config/GIMP/2.10/brushes** folder (if you are using GIMP version 2.10). If you are using some other version, you should see an equivalent folder under .config/GIMP. - -![Adding New Brushes in GIMP][8] - -Paste the brush files in this folder. Optionally, you can hide the hidden files by pressing **Ctrl+h** again. - -#### Step 3: Refresh the brushes (to avoid restarting GIMP) - -GIMP will automatically load brushes when it’s launched. If you are already running it and don’t want to close it, you can refresh the brushes. - -In GIMP go to **Windows**->**Dockable Dialogues**->**Brushes** in the main menu. - -![Refresh GIMP Brushes by going go to Windows->Dockable Dialogues-> Brushes][9] - -Locate the **refresh** icon in the **Brushes** dialog on the right side bar. - -![Refresh GIMP Brushes][10] - -If your brushes are not present, you can always try to restart GIMP. - -Bonus Tip! - -Adding new brushes in [GIMP also allows you easily watermark images][11]. Just use your logo as a brush and add it to the images in a single click. - -I hope you enjoyed this quick GIMP tip. Stay tuned for more. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/add-brushes-gimp/ - -作者:[Community][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/itsfoss/ -[b]: https://github.com/lujun9972 -[1]: https://www.gimp.org/ -[2]: https://itsfoss.com/open-source-photoshop-alternatives/ -[3]: https://itsfoss.com/gimp-2-10-release/ -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Install-New-Brushes-in-GIMP.jpg?ssl=1 -[5]: https://itsfoss.com/privacy-search-engines/ -[6]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/adding-brushes-GIMP-1.jpg?ssl=1 -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/adding-brushes-GIMP.png?ssl=1 -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/Refresh-GIMP-Brushes.jpg?ssl=1 -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/Refresh-GIMP-Brushes-2.jpg?ssl=1 -[11]: https://itsfoss.com/add-watermark-gimp-linux/ diff --git a/translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md b/translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md new file mode 100644 index 0000000000..1e43b2bc71 --- /dev/null +++ b/translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Add New Brushes in GIMP [Quick Tip]) +[#]: via: (https://itsfoss.com/add-brushes-gimp/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +如何在 GIMP 中添加新画笔(快速技巧) +====== + +[GIMP][1] 是最流行的免费和开源图像编辑器,它也许是 Linux 上最好的 [Adobe Photoshop 替代品][2]。 + +当你[在 Ubuntu 或其他任何操作系统上安装了 GIMP 后][3],你会发现已经安装了一些用于基本图像编辑的画笔。如果你需要更具体的画笔,你可以随时在 GIMP 中添加新画笔。 + +怎么样?让我在这个快速教程中向你展示。 + +### 如何在 GIMP 中添加画笔 + +![][4] + +在 GIMP 中安装新画笔需要三个步骤: + + * 获取新画笔 + * 将其放入指定的文件夹中 + * 刷新 GIMP 中的画笔 + + + +#### 步骤 1:下载新的 GIMP 画笔 + +第一步是获取新的 GIMP 画笔。你从哪里获取?当然是从互联网上。 + +你可以在 Google 或[隐私搜索引擎,如 Duck Duck Go][5] 种搜索 “GIMP画笔”,并从网站下载一个你喜欢的。 + +GIMP 画笔通常以 .gbr 和 .gih 文件格式提供。.gbr 文件用于常规画笔,而 .gih 用于动画画笔。 + +你知道吗? + +从 2.4 版本起,GIMP 使安装和使用 Photoshop 画笔(.abr 文件)非常简单。你只需将 Photoshop 画笔文件放在正确的文件夹中。 +请记住,最新的 Photoshop 画笔可能无法完美地在 GIMP 中使用。 + +#### 步骤 2:将新画笔复制到它的位置 + +获取画笔文件后,下一步是复制该文件并将其粘贴到 GIMP 配置目录中所在的文件夹。 + +在 **Windows** 上,你必须进入类似 “**C:\Documents and Settings\myusername.gimp-2.10\brushes**” 这样的文件夹。 + +我将展示 **Linux** 上的详细步骤,因为 It’s FOSS 是一个专注于 Linux 的网站。 + +选择画笔文件后,在 **Home** 目录中按下 **Ctrl+h** [查看 Linux 中的隐藏文件][6]。 + +![Press Ctrl+H to see hidden files in the home directory][7] + +你应该进入 **.config/GIMP/2.10/brushes** 文件夹(如果你使用的是 GIMP 2.10)。如果使用其他版本,那么应在 .config/GIMP 下看到相应文件夹。 + +![Adding New Brushes in GIMP][8] + +将画笔文件粘贴到此文件夹中。可选地,你可以通过再次按 **Ctrl+h** 来隐藏隐藏的文件。 + +#### 步骤 3:刷新画笔(避免重启 GIMP) + +GIMP 将在启动时自动加载画笔。如果已在运行,并且不想关闭它,你可以刷新画笔。 + +在 GIMP 的主菜单中找到 **Windows**->**Dockable Dialogues**->**Brushes**。 + +![Refresh GIMP Brushes by going go to Windows->Dockable Dialogues-> Brushes][9] + +在右侧栏的 **Brushes** 对话框中找到**刷新**图标。 + +![Refresh GIMP Brushes][10] + +如果你的画笔没有出现,那么你可以试试重启 GIMP。 + +额外的技巧! + +在 [GIMP 中添加新画笔还能让你轻松给图片添加水印][11]。只需将 logo 用作画笔,并点击一下就可添加到图片中。 + +我希望你喜欢这个快速 GIMP 技巧。敬请期待更多。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/add-brushes-gimp/ + +作者:[Community][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/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://itsfoss.com/open-source-photoshop-alternatives/ +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Install-New-Brushes-in-GIMP.jpg?ssl=1 +[5]: https://itsfoss.com/privacy-search-engines/ +[6]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/adding-brushes-GIMP-1.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/adding-brushes-GIMP.png?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/Refresh-GIMP-Brushes.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/Refresh-GIMP-Brushes-2.jpg?ssl=1 +[11]: https://itsfoss.com/add-watermark-gimp-linux/ From 785572ee1b12fe309ffd4bbc969989fe83cde4a8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 5 Mar 2020 08:37:11 +0800 Subject: [PATCH 210/260] translating --- ... an open source scientific calculator for your smartphone.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md b/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md index 32d467465a..b69120beaa 100644 --- a/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md +++ b/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fdbde56c54955e14cee2b608135200a577d6e7da Mon Sep 17 00:00:00 2001 From: qianmingtian <40565099+qianmingtian@users.noreply.github.com> Date: Thu, 5 Mar 2020 09:15:05 +0800 Subject: [PATCH 211/260] Translating by qianmingtian --- .../tech/20200305 Install and Use Wireshark on Ubuntu Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200305 Install and Use Wireshark on Ubuntu Linux.md b/sources/tech/20200305 Install and Use Wireshark on Ubuntu Linux.md index 3b0a4f6468..b1f3b76e2b 100644 --- a/sources/tech/20200305 Install and Use Wireshark on Ubuntu Linux.md +++ b/sources/tech/20200305 Install and Use Wireshark on Ubuntu Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qianmingtian) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 167fc66be563afadc2e3998cdc67ea579104be1c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Mar 2020 09:42:08 +0800 Subject: [PATCH 212/260] PRF @geekpi --- ...hing- Open Source P2P File Syncing Tool.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md b/translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md index 013a3569a4..0905f1aa3f 100644 --- a/translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md +++ b/translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Syncthing: Open Source P2P File Syncing Tool) @@ -10,11 +10,11 @@ Syncthing:开源 P2P 文件同步工具 ====== -_ **简介:Syncthing 是一个开源的 P2P 文件同步工具,可用于在多个设备(包括 Android 手机)之间同步文件。** _ +> Syncthing 是一个开源的 P2P 文件同步工具,可用于在多个设备(包括 Android 手机)之间同步文件。 -通常,我们有 [MEGA][1] 或 Dropbox 之类的云同步解决方案,以便在云上备份我们的文件,同时更易于共享。 +![](https://img.linux.net.cn/data/attachment/album/202003/05/094211oy2dosttvoaseovk.jpg) -但是,如果要跨多个设备同步文件而不将其存储在云中怎么办? +通常,我们有 [MEGA][1] 或 Dropbox 之类的云同步解决方案,以便在云上备份我们的文件,同时更易于共享。但是,如果要跨多个设备同步文件而不将其存储在云中怎么办? 这就是 [Syncthing][2] 派上用场的地方了。 @@ -22,7 +22,7 @@ _ **简介:Syncthing 是一个开源的 P2P 文件同步工具,可用于在 ![][3] -Syncthing 可让你跨多个设备同步文件(包括对 Android 智能手机的支持)。它主要通过 Linux上 的 Web UI 进行工作,但也提供了 GUI(需要单独安装)。 +Syncthing 可让你跨多个设备同步文件(包括对 Android 智能手机的支持)。它主要通过 Linux 上的 Web UI 进行工作,但也提供了 GUI(需要单独安装)。 然而,Syncthing 完全没有利用云,它是 [P2P][4] 文件同步工具。你的数据不会被发送到中央服务器。而是会在所有设备之间同步。因此,它并不能真正取代 [Linux 上的典型云存储服务][5]。 @@ -36,7 +36,7 @@ Syncthing 可让你跨多个设备同步文件(包括对 Android 智能手机 例如,你可能不想在云上存储一些敏感文件,因此你可以添加其他受信任的设备来同步并保留这些文件的副本。 -即使我简单描述了它,但它并不像看到的那么简单。如果你感兴趣的话,我建议你阅读[官方 FAQ][7] 来了解它如何工作的。 +即使我对它的描述很简单,但它并不像看到的那么简单。如果你感兴趣的话,我建议你阅读[官方 FAQ][7] 来了解它如何工作的。 ### Syncthing 的特性 @@ -90,15 +90,15 @@ Syncthing 确实非常简单且易于理解。即使这样,如果你想使用 你可能无法在软件中心找到它(如果你找到了,那它可能不是最新版本)。 -**注意:**_如果你需要一个 GUI 而不是浏览器来管理它,它还有一个 [Syncthing-GTK][16]。_ +**注意:**如果你需要一个 GUI 应用而不是浏览器来管理它,它还有一个 [Syncthing-GTK][16]。 -[Syncthing][2] +- [Syncthing][2] -如果你有基于 Debian 的发行版,你也可以利用终端来安装它,这些说明位于[官方下载页面][17] 上。 +如果你有基于 Debian 的发行版,你也可以利用终端来安装它,这些说明位于[官方下载页面][17]上。 ### 我在 Syncthing 方面的体验 -就个人而言,我把它安装在 Pop!\_OS 19.10 上,并在写这篇文章之前用了一会儿。 +就个人而言,我把它安装在 Pop!_OS 19.10 上,并在写这篇文章之前用了一会儿。 我尝试同步文件夹、删除它们、添加重复文件以查看文件版本控制是否工作,等等。它工作良好。 @@ -108,7 +108,7 @@ Syncthing 确实非常简单且易于理解。即使这样,如果你想使用 总体而言,它工作良好,但我必须说,你不应该依赖它作为唯一的数据备份方案。 -**总结** +### 总结 你试过 Syncthing 了吗?如果有的话,你的体验如何?欢迎在下面的评论中分享。 @@ -121,7 +121,7 @@ via: https://itsfoss.com/syncthing/ 作者:[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/) 荣誉推出 From 06e8186da15eb1d33a2020f08855d0cc5542299c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Mar 2020 09:44:51 +0800 Subject: [PATCH 213/260] PUB @geekpi https://linux.cn/article-11960-1.html --- .../20200121 Syncthing- Open Source P2P File Syncing Tool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200121 Syncthing- Open Source P2P File Syncing Tool.md (98%) diff --git a/translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md b/published/20200121 Syncthing- Open Source P2P File Syncing Tool.md similarity index 98% rename from translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md rename to published/20200121 Syncthing- Open Source P2P File Syncing Tool.md index 0905f1aa3f..383fc2f351 100644 --- a/translated/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md +++ b/published/20200121 Syncthing- Open Source P2P File Syncing Tool.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11960-1.html) [#]: subject: (Syncthing: Open Source P2P File Syncing Tool) [#]: via: (https://itsfoss.com/syncthing/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 6a3c2a7534b5754cca8c90b74e46a7df0c6ae5e6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Mar 2020 10:18:15 +0800 Subject: [PATCH 214/260] PRF @wxy --- ...ource productivity tools on my wishlist.md | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/translated/tech/20200130 4 open source productivity tools on my wishlist.md b/translated/tech/20200130 4 open source productivity tools on my wishlist.md index eaebf35f1d..7570c78433 100644 --- a/translated/tech/20200130 4 open source productivity tools on my wishlist.md +++ b/translated/tech/20200130 4 open source productivity tools on my wishlist.md @@ -1,30 +1,30 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 open source productivity tools on my wishlist) [#]: via: (https://opensource.com/article/20/1/open-source-productivity-tools) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) -我的愿望清单上的 4 个开源生产力工具 +我的愿望清单上的 4 种开源生产力工具 ====== -> 在 2020 年用开源实现更高生产力的二十种方式的最后一篇文章中,了解开源世界需要做什么。 +> 在 2020 年用开源实现更高生产力的二十种方式的最后一篇文章中,了解开源世界还需要什么。 -![Two diverse hands holding a globe][1] +![](https://img.linux.net.cn/data/attachment/album/202003/05/100642k52u7oydcwnc1c2w.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 -### 不过… +### 然而… -在搜索生产力应用程序时,我找不到想要的一切应用,而且几乎总是会丢失一些读者与我分享的精彩内容。 因此,当我结束本系列文章时,是时候[再次][2]谈论我在本年度系列文章中未能涵盖的一些主题。 +在搜索生产力应用程序时,我找不到想要的所有应用,而且几乎总是会丢失一些读者与我分享的精彩内容。 因此,当我结束本系列文章时,是时候[再次][2]谈论我在本年度系列文章中未能涵盖的一些主题。 ![Desktop with Joplin, Emacs, and Firefox][3] #### 在 Vim 中聊天 -我试过了。我真的非常非常想能够在 Vim 中聊天,但我做不到。我找到的一个软件包 [VimIRC.vim][4] 一直就工作不起来,我试了几天也没用。我探索的另一个选项是 [Irc it][5],这需要我付出更多的[努力去设置][6],超过了我正常可以付出的耐心或时间。我尝试过了,也确实做到了,但对于同处于相同境地的 Vim 用户,对不起,我无法帮到你。 +我试过了。我真的非常、非常想能够在 Vim 中聊天,但我做不到。我找到的一个软件包 [VimIRC.vim][4] 一直就工作不起来,我试了几天也没用。我探索的另一个选项是 [Irc it][5],这需要我付出更多的[努力去设置][6],超过了我正常可以付出的耐心或时间。我尝试过了,也确实做到了,但对于同处于相同境地的 Vim 用户,对不起,我无法帮到你。 #### Org 模式 @@ -36,15 +36,38 @@ #### 图形用户界面程序 -在 2019 年的生产力系列中,我共享了很多图形用户界面程序,而今年几乎都是命令行应用程序。有一些很棒的图形程序可以帮助解决我今年谈论的一些问题,例如可以使用 Maildir 邮箱的[邮件][12]程序、用于读取本地日历文件的日历程序、[天气][13]应用程序等等。我甚至尝试了几项对我而言新奇的事物,看它们是否适合这个主题。除了 [twin][14] 之外,我没有感觉到有什么图形用户界面程序是新颖的(对我而言)或值得注意的(同样对我而言)今年要写的。至于…… +在 2019 年的生产力系列中,我共享了很多图形用户界面程序,而今年几乎都是命令行应用程序。有一些很棒的图形程序可以帮助解决我今年谈论的一些问题,例如可以使用 Maildir 邮箱的[邮件][12]程序、用于读取本地日历文件的日历程序、[天气][13]应用程序等等。我甚至尝试了几项对我而言新奇的事物,看它们是否适合这个主题。除了 [twin][14] 之外,我没有感觉到有什么图形用户界面程序是新颖的(对我而言)或值得注意的(同样对我而言)是今年要写的。至于…… #### 移动应用程序 -越来越多的人将平板电脑(有时与笔记本电脑结合使用)作为主要设备。我将手机用于大多数社交媒体和即时消息传递,并且经常使用平板电脑(好的,老实说,好几个平板电脑)来阅读或浏览网络。可以肯定的是,并不是开源移动应用程序不存在,但是它们与我今年的主题不符。开源和移动应用程序正在发生很多变化,我正在仔细地寻找可以帮助我在手机和平板电脑上提高工作效率的事物。 +越来越多的人将平板电脑(有时与笔记本电脑结合使用)作为主要设备。我将手机用于大多数社交媒体和即时消息传递,并且经常使用平板电脑(好的,老实说,好几个平板电脑)来阅读或浏览网络。可以肯定的是,并不是没有开源移动应用程序,但是它们与我今年的主题不符。开源和移动应用程序正在发生很多变化,我正在仔细地寻找可以帮助我在手机和平板电脑上提高工作效率的事物。 ### 该你了 -非常感谢你阅读今年的系列文章。请你发表评论,告诉我错过的或需要在 2021 年看到的内容。正如我在 [Productivity Alchemy] [15] 播客上所说:“哥们,记着:保持生产力!” +非常感谢你阅读今年的系列文章。请你发表评论,告诉我错过的或需要在 2021 年看到的内容。正如我在 [Productivity Alchemy][15] 播客上所说:“哥们,记着:要保持生产力!” + +### 本系列汇总 + +1. [使用 Syncthing 在多个设备间同步文件](https://linux.cn/article-11793-1.html) +2. [使用 Stow 管理多台机器配置](https://linux.cn/article-11796-1.html) +3. [使用 OfflineIMAP 同步邮件](https://linux.cn/article-11804-1.html) +4. [使用 Notmuch 组织你的邮件](https://linux.cn/article-11807-1.html) +5. [使用 khal 和 vdirsyncer 组织和同步你的日历](https://linux.cn/article-11812-1.html) +6. [用于联系人管理的三个开源工具](https://linux.cn/article-11834-1.html) +7. [开始使用开源待办事项清单管理器](https://linux.cn/article-11835-1.html) +8. [使用这个 Python 程序记录你的活动](https://linux.cn/article-11846-1.html) +9. [一个通过 IRC 管理所有聊天的开源聊天工具](https://linux.cn/article-11856-1.html) +10. [使用这个 Twitter 客户端在 Linux 终端中发推特](https://linux.cn/article-11858-1.html) +11. [在 Linux 终端中阅读 Reddit](https://linux.cn/article-11869-1.html) +12. [使用此开源工具在一起收取你的 RSS 订阅源和播客](https://linux.cn/article-11876-1.html) +13. [使用这个开源工具获取本地天气预报](https://linux.cn/article-11879-1.html) +14. [使用此开源窗口环境一次运行多个控制台](https://linux.cn/article-11892-1.html) +15. [使用 tmux 创建你的梦想主控台](https://linux.cn/article-11900-1.html) +16. [使用 Vim 发送邮件和检查日历](https://linux.cn/article-11908-1.html) +17. [使用 Vim 管理任务列表和访问 Reddit 和 Twitter](https://linux.cn/article-11912-1.html) +18. [使用 Emacs 发送电子邮件和检查日历](https://linux.cn/article-11932-1.html) +19. [使用 Emacs 进行社交并跟踪你的待办事项列表](https://linux.cn/article-11956-1.html) +20. [我的愿望清单上的 4 种开源生产力工具](https://linux.cn/article-11961-1.html) -------------------------------------------------------------------------------- @@ -53,7 +76,7 @@ via: https://opensource.com/article/20/1/open-source-productivity-tools 作者:[Kevin 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 48849f6708f7dd121d1ad26ad5438a879d31a027 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Mar 2020 10:18:44 +0800 Subject: [PATCH 215/260] PUB @wxy https://linux.cn/article-11961-1.html --- ...0200130 4 open source productivity tools on my wishlist.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200130 4 open source productivity tools on my wishlist.md (98%) diff --git a/translated/tech/20200130 4 open source productivity tools on my wishlist.md b/published/20200130 4 open source productivity tools on my wishlist.md similarity index 98% rename from translated/tech/20200130 4 open source productivity tools on my wishlist.md rename to published/20200130 4 open source productivity tools on my wishlist.md index 7570c78433..533247844b 100644 --- a/translated/tech/20200130 4 open source productivity tools on my wishlist.md +++ b/published/20200130 4 open source productivity tools on my wishlist.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11961-1.html) [#]: subject: (4 open source productivity tools on my wishlist) [#]: via: (https://opensource.com/article/20/1/open-source-productivity-tools) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) From 22ec776fbb6af45f69863ef820b4cf96230584ed Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Mar 2020 16:37:46 +0800 Subject: [PATCH 216/260] APL --- ...0303 Getting started with the Rust package manager, Cargo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200303 Getting started with the Rust package manager, Cargo.md b/sources/tech/20200303 Getting started with the Rust package manager, Cargo.md index d77410b904..9d3429f1bd 100644 --- a/sources/tech/20200303 Getting started with the Rust package manager, Cargo.md +++ b/sources/tech/20200303 Getting started with the Rust package manager, Cargo.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 792460af0e4bd1846de1970d8cf85b046f43c74f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Mar 2020 18:23:10 +0800 Subject: [PATCH 217/260] TSL --- ...ed with the Rust package manager, Cargo.md | 607 ------------------ ...ed with the Rust package manager, Cargo.md | 561 ++++++++++++++++ 2 files changed, 561 insertions(+), 607 deletions(-) delete mode 100644 sources/tech/20200303 Getting started with the Rust package manager, Cargo.md create mode 100644 translated/tech/20200303 Getting started with the Rust package manager, Cargo.md diff --git a/sources/tech/20200303 Getting started with the Rust package manager, Cargo.md b/sources/tech/20200303 Getting started with the Rust package manager, Cargo.md deleted file mode 100644 index 9d3429f1bd..0000000000 --- a/sources/tech/20200303 Getting started with the Rust package manager, Cargo.md +++ /dev/null @@ -1,607 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with the Rust package manager, Cargo) -[#]: via: (https://opensource.com/article/20/3/rust-cargo) -[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) - -Getting started with the Rust package manager, Cargo -====== -Get to know Rust's package manager and build tool. -![Shipping containers stacked in a yard][1] - -[Rust][2] is a modern programming language that provides performance, reliability, and productivity. It has consistently been voted as the [most-loved language][3] on StackOverflow surveys for a few years now. - -In addition to being a great programming language, Rust also features a build system and package manager called Cargo. Cargo handles a lot of tasks, like building code, downloading libraries or dependencies, and so on. The two are bundled together, so you get Cargo when you install Rust. - -### Installing Rust and Cargo - -Before getting started, you need to install Rust and Cargo. The Rust project provides a downloadable script to handle the installation. To get the script, open a browser to [https://sh.rustup.rs][4] and save the file. Read the script to make sure you're happy with what it intends to do, and then run it: - - -``` -`$ sh ./rustup.rs` -``` - -You can also refer to the [Install Rust][5] webpage for more information. - -After installing Rust and Cargo, you must source the env file: - - -``` -`$ source $HOME/.cargo/env` -``` - -Better yet, add the required directory to your PATH variable: - - -``` -`$ source $HOME/.cargo/env` -``` - -If you prefer to use your package manager (such as DNF or Apt on Linux), look for Rust and Cargo packages in your distribution's repositories and install accordingly. For example: - - -``` -`$ dnf install rust cargo` -``` - -Once they're installed and set up, verify which versions of Rust and Cargo you have: - - -``` -$ rustc --version -rustc 1.41.0 (5e1a79984 2020-01-27) -$ cargo --version -cargo 1.41.0 (626f0f40e 2019-12-03) -``` - -### Building and running Rust by hand - -Start with a simple program that prints "Hello, world!" on the screen. Open your favorite text editor and type the following program: - - -``` -$ cat hello.rs -fn main() { -    println!("Hello, world!"); -} -``` - -Save the file with an **.rs** extension to identify it as a Rust source code file. - -Compile your program using the Rust compiler, **rustc**: - - -``` -`$ rustc hello.rs` -``` - -After compilation, you will have a binary that has the same name as the source program: - - -``` -$ ls -l -total 2592 --rwxr-xr-x. 1 user group 2647944 Feb 13 14:14 hello --rw-r--r--. 1 user group      45 Feb 13 14:14 hello.rs -$ -``` - -Execute your program to verify that it runs as expected: - - -``` -$ ./hello -Hello, world! -``` - -These steps are sufficient for smaller programs or whenever you want to test out something quickly. However, when working on bigger programs involving multiple people, Cargo is the best way forward. - -### Creating a new package using Cargo - -Cargo is a build system and package manager for Rust. It helps developers download and manage dependencies and assists in creating Rust packages. Packages in Rust are often called "crates" in the Rust community, but in this article, the two words are interchangeable. Refer to the Cargo [FAQ][6] provided by the Rust community for clarification. - -If you need any help with Cargo's command-line utility, use the **\--help** or **-h** command-line argument: - - -``` -`$ cargo –help` -``` - -To create a new package, use the **new** keyword, followed by the package name. For this example, use **hello_opensource** as your new package name. After running the command, you will see a message confirming that Cargo has created a binary package with the given name: - - -``` -$ cargo new hello_opensource -     Created binary (application) `hello_opensource` package -``` - -Running a **tree** command to see the directory structure reports that some files and directories were created. First, it creates a directory with the name of the package, and within that directory is an **src** directory for your source code files: - - -``` -$ tree . -. -└── hello_opensource -    ├── Cargo.toml -    └── src -        └── main.rs - -2 directories, 2 files -``` - -Cargo not only creates a package, but it also creates a simple **Hello, world!** program. Open the **main.rs** file and have a look: - - -``` -$ cat hello_opensource/src/main.rs -fn main() { -    println!("Hello, world!"); -} -``` - -The next file to work with is **Cargo.toml**, which is a configuration file for your package. It contains information about the package, such as its name, version, author information, and Rust edition information. - -A program often depends on external libraries or dependencies to run, which enables you to write applications that perform tasks that you don't know how to code or you don't want to spend time coding. All your dependencies will be listed in this file. At this point, you do not have any dependencies for your new program. Open the **Cargo.toml** file and view its contents: - - -``` -$ cat hello_opensource/Cargo.toml -[package] -name = "hello_opensource" -version = "0.1.0" -authors = ["user <[user@mail.com][7]>"] -edition = "2018" - -# See more keys and their definitions at - -[dependencies] -``` - -### Building the program using Cargo - -So far, so good. Now that you have a package in place, build a binary (also called an executable). Before doing that, move into the package directory: - - -``` -`$ cd hello_opensource/` -``` - -You can use Cargo's **build** command to build the package. Notice the messages that say it is **Compiling** your program: - - -``` -$ cargo build -   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) -    Finished dev [unoptimized + debuginfo] target(s) in 0.38s -``` - -Check what happens to your project directory after you run the **build** command: - - -``` -$ tree . -. -├── Cargo.lock -├── Cargo.toml -├── src -│   └── main.rs -└── target -    └── debug -        ├── build -        ├── deps -        │   ├── hello_opensource-147b8a0f466515dd -        │   └── hello_opensource-147b8a0f466515dd.d -        ├── examples -        ├── hello_opensource -        ├── hello_opensource.d -        └── incremental -            └── hello_opensource-3pouh4i8ttpvz -                ├── s-fkmhjmt8tj-x962ep-1hivstog8wvf -                │   ├── 1r37g6m45p8rx66m.o -                │   ├── 2469ykny0eqo592v.o -                │   ├── 2g5i2x8ie8zed30i.o -                │   ├── 2yrvd7azhgjog6zy.o -                │   ├── 3g9rrdr4hyk76jtd.o -                │   ├── dep-graph.bin -                │   ├── query-cache.bin -                │   ├── work-products.bin -                │   └── wqif2s56aj0qtct.o -                └── s-fkmhjmt8tj-x962ep.lock - -9 directories, 17 files -``` - -Wow! The compilations process produced a lot of intermediate files. Your binary, though, is saved in the **./target/debug** directory with the same name as your package. - -### Running your application using Cargo - -Now that your binary is built, run it using Cargo's **run** command. As expected, it prints **Hello, world!** on the screen. - - -``` -$ cargo run -    Finished dev [unoptimized + debuginfo] target(s) in 0.01s -     Running `target/debug/hello_opensource` -Hello, world! -``` - -Alternatively, you can run the binary directly, which is located at: - - -``` -$ ls -l ./target/debug/hello_opensource --rwxr-xr-x. 2 root root 2655552 Feb 13 14:19 ./target/debug/hello_opensource -``` - -As expected, it produces the same results: - - -``` -$ ./target/debug/hello_opensource -Hello, world! -``` - -Say you need to rebuild your package and get rid of all the binaries and the intermediate files created by the earlier compilation process. Cargo provides a handy **clean** option to remove all intermediate files except the source code and other required files: - - -``` -$ cargo clean -$ tree . -. -├── Cargo.lock -├── Cargo.toml -└── src -    └── main.rs - -1 directory, 3 files -``` - -Make some changes to the program and run it again to see how it works. For example, this minor change adds **Opensource** to the **Hello, world!** string: - - -``` -$ cat src/main.rs -fn main() { -    println!("Hello, Opensource world!"); -} -``` - -Now, build the program and run it again. This time you see **Hello, Opensource world!** displayed on the screen: - - -``` -$ cargo build -   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) -    Finished dev [unoptimized + debuginfo] target(s) in 0.39s - -$ cargo run -    Finished dev [unoptimized + debuginfo] target(s) in 0.01s -     Running `target/debug/hello_opensource` -Hello, Opensource world! -``` - -### Adding dependencies using Cargo - -Cargo allows you to add dependencies that your program needs to run. Adding a dependency is extremely easy with Cargo. Every Rust package includes a **Cargo.toml** file, which contains a list (empty by default) of dependencies. Open the file in your favorite text editor, find the **[dependencies]** section, and add the library you want to include in your package. For example, to add the **rand** library as your dependency: - - -``` -$ cat Cargo.toml -[package] -name = "hello_opensource" -version = "0.1.0" -authors = ["test user <[test@mail.com][8]>"] -edition = "2018" - -# See more keys and their definitions at - -[dependencies] -rand = "0.3.14" -``` - -Try building your package to see what happens. - - -``` -$ cargo build -    Updating crates.io index -   Compiling libc v0.2.66 -   Compiling rand v0.4.6 -   Compiling rand v0.3.23 -   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) -    Finished dev [unoptimized + debuginfo] target(s) in 4.48s -``` - -Cargo is now reaching out to [Crates.io][9], which is Rust's central repository for crates (or packages) and downloading and compiling **rand**. But wait—what about the **libc** package? You did not ask for **libc** to be installed. Well, the **rand** package is dependent on the **libc** package; hence, Cargo downloads and compiles **libc** as well. - -New versions of libraries keep coming, and Cargo provides an easy way to update all of their dependencies using the **update** command: - - -``` -`cargo update` -``` - -You can also choose to update specific libraries using the **-p** flag followed by the package name: - - -``` -`cargo update -p rand` -``` - -### Compiling and running with a single command - -So far, you have used **build** followed by **run** whenever you make changes to your program. There is an easier way: you can simply use the **run** command, which internally compiles and runs the program. To see how it works, first clean up your package directory: - - -``` -$ cargo clean -$ tree . -. -├── Cargo.lock -├── Cargo.toml -└── src -    └── main.rs - -1 directory, 3 files -``` - -Now execute **run**. The output states that it compiled and then ran the program, and this means you don't need to explicitly run **build** each time: - - -``` -$ cargo run -   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) -    Finished dev [unoptimized + debuginfo] target(s) in 0.41s -     Running `target/debug/hello_opensource` -Hello, world! -``` - -### Checking your code in development - -You often go through multiple iterations when developing a program. You need to ensure that your program has no coding errors and compiles fine. You don't need the overhead of generating the binary on each compilation. Cargo has you covered with a **check** option that compiles your code but skips the final step of generating an executable. - -Start by running **cargo clean** within your package directory: - - -``` -$ tree . -. -├── Cargo.lock -├── Cargo.toml -└── src -    └── main.rs - -1 directory, 3 files -``` - -Now run the **check** command and see what changes were made to the directory: - - -``` -$ cargo check -    Checking hello_opensource v0.1.0 (/opensource/hello_opensource) -    Finished dev [unoptimized + debuginfo] target(s) in 0.18s -``` - -The output shows that, even though intermediate files were created as part of the compilation process, the final binary or executable was not created. This saves some time, which matters a lot if the package is huge with thousands of lines of code: - - -``` -$ tree . -. -├── Cargo.lock -├── Cargo.toml -├── src -│   └── main.rs -└── target -    └── debug -        ├── build -        ├── deps -        │   ├── hello_opensource-842d9a06b2b6a19b.d -        │   └── libhello_opensource-842d9a06b2b6a19b.rmeta -        ├── examples -        └── incremental -            └── hello_opensource-1m3f8arxhgo1u -                ├── s-fkmhw18fjk-542o8d-18nukzzq7hpxe -                │   ├── dep-graph.bin -                │   ├── query-cache.bin -                │   └── work-products.bin -                └── s-fkmhw18fjk-542o8d.lock - -9 directories, 9 files -``` - -To see if you are really saving time, time the **build** and **check** commands and compare them. - -First, the **build** command: - - -``` -$ time cargo build -   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) -    Finished dev [unoptimized + debuginfo] target(s) in 0.40s - -real    0m0.416s -user    0m0.251s -sys     0m0.199s -``` - -Clean the directory before running the **check** command: - - -``` -`$ cargo clean` -``` - -The **check** command: - - -``` -$ time cargo check -    Checking hello_opensource v0.1.0 (/opensource/hello_opensource) -    Finished dev [unoptimized + debuginfo] target(s) in 0.15s - -real    0m0.166s -user    0m0.086s -sys     0m0.081s -``` - -Clearly, the **check** command is much faster. - -### Building external Rust packages - -Everything you've done so far will apply to any Rust crate you get from the internet. You simply need to download or clone the repository, move to the package folder, and run the **build** command, and you are good to go: - - -``` -git clone <github-like-url> -cd <package-folder> -cargo build -``` - -### Building optimized Rust programs using Cargo - -You've run **build** multiple times so far, but did you notice its output? No worries, build it again and watch closely: - - -``` -$ cargo build -   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) -    Finished dev [unoptimized + debuginfo] target(s) in 0.36s -``` - -See the **[unoptimized + debuginfo]** text after each compilation? This means that the binary generated by Cargo includes a lot of debugging information and is not optimized for execution. Developers often go through multiple iterations of development and need this debugging information for analysis. Also, performance is not the immediate goal while developing software. Therefore, this is OK for now. - -However, once the software is ready for release, it doesn't need to have the debugging information anymore. But it does need to be optimized for best performance. In the final stages of development, you can use the **\--release** flag with **build**. Watch closely; you should see the **[optimized]** text after compilation: - - -``` -$ cargo build --release -   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) -    Finished release [optimized] target(s) in 0.29s -``` - -If you want to, you can go through the exercise to find out your time savings when running optimized vs. unoptimized software. - -### Creating a library vs. a binary using Cargo - -Any software program can be roughly categorized as either a standalone binary or a library. A standalone binary can be run as it is, even though it might make use of external libraries. A library, however, is utilized by another standalone binary. All the programs you've built so far in this tutorial are standalone binaries since that is Cargo's default. To create a **library**, add the **\--lib** option: - - -``` -$ cargo new --lib libhello -     Created library `libhello` package -``` - -This time, Cargo does not create a **main.rs** file; instead, it creates a **lib.rs** file. The code for your library should go here: - - -``` -$ tree . -. -└── libhello -    ├── Cargo.toml -    └── src -        └── lib.rs - -2 directories, 2 files -``` - -Knowing Cargo, don't be surprised that it put some code in your new library file. Find out what it added by moving to the package directory and viewing the file. By default, Cargo puts a test function within library files. - -### Running tests using Cargo - -Rust provides first-class support for unit and integration testing, and Cargo allows you to execute any of these tests: - - -``` -$ cd libhello/ - -$ cat src/lib.rs -#[cfg(test)] -mod tests { -    #[test] -    fn it_works() { -        assert_eq!(2 + 2, 4); -    } -} -``` - -Cargo has a handy **test** option to run any test that is present in your code. Try running the tests that Cargo put in the library code by default: - - -``` -$ cargo test -   Compiling libhello v0.1.0 (/opensource/libhello) -    Finished test [unoptimized + debuginfo] target(s) in 0.55s -     Running target/debug/deps/libhello-d52e35bb47939653 - -running 1 test -test tests::it_works ... ok - -test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out - -   Doc-tests libhello - -running 0 tests - -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out -``` - -### Looking under Cargo's hood - -You may be interested in knowing what Cargo does under the hood when you run a command. After all, Cargo is, in many ways, a wrapper. To find out what it's doing, you can use the **-v** option with any Cargo command to output verbose information to the screen. - -Here are a couple of examples that run **build** and **clean** using the **-v** option. - -In the **build** command, you can see that the underlying **rustc** (Rust compiler) fired with the given command-line options: - - -``` -$ cargo build -v -   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) -     Running `rustc --edition=2018 --crate-name hello_opensource src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=147b8a0f466515dd -C extra-filename=-147b8a0f466515dd --out-dir /opensource/hello_opensource/target/debug/deps -C incremental=/opensource/hello_opensource/target/debug/incremental -L dependency=/opensource/hello_opensource/target/debug/deps` -    Finished dev [unoptimized + debuginfo] target(s) in 0.36s -``` - -Whereas the **clean** command shows that it is simply removing the directory that contains the intermediate files and the binary: - - -``` -$ cargo clean -v -    Removing /opensource/hello_opensource/target -``` - -### Don't let your skills get rusty - -To expand your skills, try writing and running a slightly more complex program using Rust and Cargo. Something simple will do: for instance, try listing all files in the current directory (it can be done in nine lines of code), or try echoing input back out at yourself. Small practice applications help you get comfortable with the syntax and the process of writing and testing code. - -This article offers plenty of information for budding Rust programmers to get started with Cargo. However, as you begin working on larger and more complicated programs, you'll need a more advanced understanding of Cargo. When you're ready for more, download and read the open source [Cargo Book][10] written by the Rust team, and see what you can create! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/rust-cargo - -作者:[Gaurav Kamathe][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/gkamathe -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-containers2.png?itok=idd8duC_ (Shipping containers stacked in a yard) -[2]: https://www.rust-lang.org/ -[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages -[4]: https://sh.rustup.rs/ -[5]: https://www.rust-lang.org/tools/install -[6]: https://doc.rust-lang.org/cargo/faq.html -[7]: mailto:user@mail.com -[8]: mailto:test@mail.com -[9]: http://crates.io -[10]: https://doc.rust-lang.org/cargo diff --git a/translated/tech/20200303 Getting started with the Rust package manager, Cargo.md b/translated/tech/20200303 Getting started with the Rust package manager, Cargo.md new file mode 100644 index 0000000000..b289dd6f00 --- /dev/null +++ b/translated/tech/20200303 Getting started with the Rust package manager, Cargo.md @@ -0,0 +1,561 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with the Rust package manager, Cargo) +[#]: via: (https://opensource.com/article/20/3/rust-cargo) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +Rust 包管理器 Cargo 入门 +====== + +> 了解 Rust 的软件包管理器和构建工具。 + +![Shipping containers stacked in a yard][1] + +[Rust][2] 是一种现代编程语言,可提供高性能、可靠性和生产力。几年来,它一直被 StackOverflow 调查评为[最受欢迎的语言][3]。 + +除了是一种出色的编程语言之外,Rust 还具有一个称为 Cargo 的构建系统和软件包管理器。Cargo 处理许多任务,例如构建代码、下载库或依赖项等等。这两者捆绑在一起,因此在安装 Rust 时会得到 Cargo。 + +### 安装 Rust 和 Cargo + +在开始之前,你需要安装 Rust 和 Cargo。Rust 项目提供了一个可下载的脚本来处理安装。要获取该脚本,请打开浏览器以访问 [https://sh.rustup.rs][4] 并保存该文件。阅读脚本以确保你对它的具体行为有所了解,然后运行它: + +``` +$ sh ./rustup.rs +``` + +你也可以参考这个[安装 Rust][5]网页以获取更多信息。 + +安装 Rust 和 Cargo 之后,你必须获取source `env` 文件: + +``` +$ source $HOME/.cargo/env +``` + +更好的是,将所需目录添加到 `PATH` 环境变量中: + +``` +export PATH=$PATH:~/.cargo/bin +``` + +如果你更喜欢使用软件包管理器(例如 Linux 上的 DNF 或 Apt),请在发行版本的存储库中查找 Rust 和 Cargo 软件包,并进行相应的安装。 例如: + +``` +$ dnf install rust cargo +``` + +安装并设置它们后,请验证你拥有的 Rust 和 Cargo 版本: + +``` +$ rustc --version +rustc 1.41.0 (5e1a79984 2020-01-27) +$ cargo --version +cargo 1.41.0 (626f0f40e 2019-12-03) +``` + +### 手动构建和运行 Rust + +从在屏幕上打印“Hello, world!”的简单程序开始。打开你喜欢的文本编辑器,然后键入以下程序: + +``` +$ cat hello.rs +fn main() { +    println!("Hello, world!"); +} +``` + +以扩展名 `.rs` 保存文件,以将其标识为 Rust 源代码文件。 + +使用 Rust 编译器 `rustc` 编译程序: + +``` +$ rustc hello.rs +``` + +编译后,你将拥有一个与源程序同名的二进制文件: + +``` +$ ls -l +total 2592 +-rwxr-xr-x. 1 user group 2647944 Feb 13 14:14 hello +-rw-r--r--. 1 user group      45 Feb 13 14:14 hello.rs +$ +``` + +执行程序以验证其是否按预期运行: + +``` +$ ./hello +Hello, world! +``` + +这些步骤对于较小的程序或任何你想快速测试的东西就足够了。但是,在进行涉及多人的大型计划时,Cargo 是前进的最佳之路。 + +### 使用 Cargo 创建新包 + +Cargo 是 Rust 的构建系统和包管理器。它可以帮助开发人员下载和管理依赖项,并帮助创建 Rust 包。在Rust 社区中,Rust 中的“包”通常被称为“crate”(板条箱),但是在本文中,这两个词是可以互换的。请参阅 Rust 社区提供的 Cargo [FAQ][6] 来区分。 + +如果你需要有关 Cargo 命令行实用程序的任何帮助,请使用 `--help` 或 `-h` 命令行参数: + +``` +$ cargo –help +``` + +要创建一个新的包,请使用关键字 `new`,跟上包名称。在这个例子中,使用 `hello_opensource` 作为新的包名称。运行该命令后,你将看到一条消息,确认 Cargo 已创建具有给定名称的二进制包: + +``` +$ cargo new hello_opensource +     Created binary (application) `hello_opensource` package +``` + +运行 `tree` 命令以查看目录结构,它会报告已创建了一些文件和目录。首先,它创建一个带有包名称的目录,并且在该目录内有一个存放你的源代码文件的 `src` 目录: + +``` +$ tree . +. +└── hello_opensource +    ├── Cargo.toml +    └── src +        └── main.rs + +2 directories, 2 files +``` + +Cargo 不仅可以创建包,它也创建了一个简单的 “Hello, world” 程序。打开 `main.rs` 文件看看: + +``` +$ cat hello_opensource/src/main.rs +fn main() { +    println!("Hello, world!"); +} +``` + +下一个要处理的文件是 `Cargo.toml`,这是你的包的配置文件。它包含有关包的信息,例如其名称、版本、作者信息和 Rust 版本信息。 + +程序通常依赖于外部库或依赖项来运行,这使你可以编写应用程序来执行不知道如何编码或不想花时间编码的任务。你所有的依赖项都将在此文件中列出。此时,对你的新程序你没有任何依赖关系。打开 `Cargo.toml` 文件并查看其内容: + +``` +$ cat hello_opensource/Cargo.toml +[package] +name = "hello_opensource" +version = "0.1.0" +authors = ["user "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +``` + +### 使用 Cargo 构建程序 + +到目前为止,一切都很顺利。现在你已经有了一个包,可构建一个二进制文件(也称为可执行文件)。在此之前,进入包目录: + +``` +$ cd hello_opensource/ +``` + +你可以使用 Cargo 的 `build` 命令来构建包。注意消息说它正在“编译”你的程序: + +``` +$ cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.38s +``` + +运行 `build` 命令后,检查项目目录发生了什么: + +``` +$ tree . +. +├── Cargo.lock +├── Cargo.toml +├── src +│   └── main.rs +└── target +    └── debug +        ├── build +        ├── deps +        │   ├── hello_opensource-147b8a0f466515dd +        │   └── hello_opensource-147b8a0f466515dd.d +        ├── examples +        ├── hello_opensource +        ├── hello_opensource.d +        └── incremental +            └── hello_opensource-3pouh4i8ttpvz +                ├── s-fkmhjmt8tj-x962ep-1hivstog8wvf +                │   ├── 1r37g6m45p8rx66m.o +                │   ├── 2469ykny0eqo592v.o +                │   ├── 2g5i2x8ie8zed30i.o +                │   ├── 2yrvd7azhgjog6zy.o +                │   ├── 3g9rrdr4hyk76jtd.o +                │   ├── dep-graph.bin +                │   ├── query-cache.bin +                │   ├── work-products.bin +                │   └── wqif2s56aj0qtct.o +                └── s-fkmhjmt8tj-x962ep.lock + +9 directories, 17 files +``` + +哇!编译过程产生了许多中间文件。另外,你的二进制文件将以与软件包相同的名称保存在 `./target/debug` 目录中。 + +### 使用 Cargo 运行你的应用程序 + +现在你的二进制文件已经构建好了,使用 Cargo 的 `run` 命令运行它。如预期的那样,它将在屏幕上打印 `Hello, world!`。 + +``` +$ cargo run +    Finished dev [unoptimized + debuginfo] target(s) in 0.01s +     Running `target/debug/hello_opensource` +Hello, world! +``` + +或者,你可以直接运行二进制文件,该文件位于: + +``` +$ ls -l ./target/debug/hello_opensource +-rwxr-xr-x. 2 root root 2655552 Feb 13 14:19 ./target/debug/hello_opensource +``` + +如预期的那样,它产生相同的结果: + +``` +$ ./target/debug/hello_opensource +Hello, world! +``` + +假设你需要重建包,并丢弃早期编译过程创建的所有二进制文件和中间文件。Cargo 提供了一个方便的`clean` 选项来删除所有中间文件,但源代码和其他必需文件除外: + +``` +$ cargo clean +$ tree . +. +├── Cargo.lock +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 3 files +``` + +对程序进行一些更改,然后再次运行以查看其工作方式。例如,下面这个较小的更改将 `Opensource` 添加到 `Hello, world!` 字符串中: + +``` +$ cat src/main.rs +fn main() { +    println!("Hello, Opensource world!"); +} +``` + +现在,构建程序并再次运行它。这次,你会在屏幕上看到 `Hello, Opensource world!`: + +``` +$ cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.39s + +$ cargo run +    Finished dev [unoptimized + debuginfo] target(s) in 0.01s +     Running `target/debug/hello_opensource` +Hello, Opensource world! +``` + +### 使用 Cargo 添加依赖项 + +Cargo 允许你添加程序需要运行的依赖项。使用 Cargo 添加依赖项非常容易。每个 Rust 包都包含一个 `Cargo.toml` 文件,其中包含一个依赖关系列表(默认为空)。用你喜欢的文本编辑器打开该文件,找到 `[dependencies]` 部分,然后添加要包含在包中的库。例如,将 `rand` 库添加为依赖项: + +``` +$ cat Cargo.toml +[package] +name = "hello_opensource" +version = "0.1.0" +authors = ["test user "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +rand = "0.3.14" +``` + +试试构建你的包,看看会发生什么。 + +``` +$ cargo build +    Updating crates.io index +   Compiling libc v0.2.66 +   Compiling rand v0.4.6 +   Compiling rand v0.3.23 +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 4.48s +``` + +现在,Cargo 会联系 [Crates.io][9],这是 Rust 用于存储 crate(或包)的中央仓库,并下载和编译 `rand`。但是,等等 —— `libc` 包是怎么回事?你没有要要安装 libc 啊。是的,`rand` 包依赖于 `libc` 包;因此,Cargo 也会下载并编译 `libc`。 + +库的新版本不断涌现,而 Cargo 提供了一种使用 `update` 命令更新其所有依赖关系的简便方法: + +``` +cargo update +``` + +你还可以选择使用 `-p` 标志跟上包名称来更新特定的库: + +``` +cargo update -p rand +``` + +### 使用单个命令进行编译和运行 + +到目前为止,每当对程序进行更改时,都先使用了 `build` 之后是 `run`。有一个更简单的方法:你可以直接使用 `run` 命令,该命令会在内部进行编译并运行该程序。要查看其工作原理,请首先清理你的软件包目录: + +``` +$ cargo clean +$ tree . +. +├── Cargo.lock +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 3 files +``` + +现在执行 `run`。输出信息表明它已进行编译,然后运行了该程序,这意味着你不需要每次都显式地运行 `build`: + +``` +$ cargo run +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.41s +     Running `target/debug/hello_opensource` +Hello, world! +``` + +### 在开发过程中检查代码 + +在开发程序时,你经常会经历多次迭代。你需要确保你的程序没有编码错误并且可以正常编译。你不需要负担在每次编译时生成二进制文件的开销。Cargo 为你提供了一个 `check` 选项,该选项可以编译代码,但跳过了生成可执行文件的最后一步。首先在包目录中运行 `cargo clean`: + +``` +$ tree . +. +├── Cargo.lock +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 3 files +``` + +现在运行 `check` 命令,查看对目录进行了哪些更改: + +``` +$ cargo check +    Checking hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.18s +``` + +该输出显示,即使在编译过程中创建了中间文件,但没有创建最终的二进制文件或可执行文件。这样可以节省一些时间,如果该包包含了数千行代码,这非常重要: + +``` +$ tree . +. +├── Cargo.lock +├── Cargo.toml +├── src +│   └── main.rs +└── target +    └── debug +        ├── build +        ├── deps +        │   ├── hello_opensource-842d9a06b2b6a19b.d +        │   └── libhello_opensource-842d9a06b2b6a19b.rmeta +        ├── examples +        └── incremental +            └── hello_opensource-1m3f8arxhgo1u +                ├── s-fkmhw18fjk-542o8d-18nukzzq7hpxe +                │   ├── dep-graph.bin +                │   ├── query-cache.bin +                │   └── work-products.bin +                └── s-fkmhw18fjk-542o8d.lock + +9 directories, 9 files +``` + +要查看你是否真的节省了时间,请对 `build` 和 `check` 命令进行计时并进行比较。首先,计时 `build` 命令: + +``` +$ time cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.40s + +real    0m0.416s +user    0m0.251s +sys     0m0.199s +``` + +在运行 `check` 命令之前清理目录: + +``` +$ cargo clean +``` + +计时 `check` 命令: + +``` +$ time cargo check +    Checking hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.15s + +real    0m0.166s +user    0m0.086s +sys     0m0.081s +``` + +显然,`check` 命令要快得多。 + +### 建立外部 Rust 包 + +到目前为止,你所做的这些都可以应用于你从互联网上获得的任何 Rust crate。你只需要下载或克隆存储库,移至包文件夹,然后运行 `build` 命令,就可以了: + +``` +git clone +cd +cargo build +``` + +### 使用 Cargo 构建优化的 Rust 程序 + +到目前为止,你已经多次运行 `build`,但是你注意到它的输出了吗?不用担心,再次构建它并密切注意: + +``` +$ cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.36s +``` + +看到了每次编译后的 `[unoptimized + debuginfo]` 文本了吗?这意味着 Cargo 生成的二进制文件包含大量调试信息,并且未针对执行进行优化。开发人员经常经历开发的多次迭代,并且需要此调试信息进行分析。同样,性能并不是开发软件时的近期目标。因此,对于现在而言是没问题的。 + +但是,一旦准备好发布软件,就不再需要这些调试信息。而是需要对其进行优化以获得最佳性能。在开发的最后阶段,可以将 `--release` 标志与 `build` 一起使用。仔细看,编译后,你应该会看到 `[optimized]` 文本: + +``` +$ cargo build --release +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished release [optimized] target(s) in 0.29s +``` + +如果愿意,你可以通过这种练习来了解运行优化软件与未优化软件时节省的时间。 + +### 使用 Cargo 创建库还是二进制文件 + +任何软件程序都可以粗略地分类为独立二进制文件或库。一个独立二进制文件也许即使是当中外部库使用的,自身也是可以运行的。但是,作为一个库,是可以被另一个独立二进制文件所利用的。到目前为止,你在本教程中构建的所有程序都是独立二进制文件,因为这是 Cargo 的默认设置。 要创建一个**库**,请添加 `--lib` 选项: + +``` +$ cargo new --lib libhello +     Created library `libhello` package +``` + +这次,Cargo 不会创建 `main.rs` 文件,而是创建一个 `lib.rs` 文件。 你的库的代码应该是这样的: + +``` +$ tree . +. +└── libhello +    ├── Cargo.toml +    └── src +        └── lib.rs + +2 directories, 2 files +``` + +Cargo 就是这样的,不要奇怪,它在你的新库文件中添加了一些代码。通过移至包目录并查看文件来查找添加的内容。默认情况下,Cargo 在库文件中放置一个测试函数。 + +### 使用 Cargo 运行测试 + +Rust 为单元测试和集成测试提供了一流的支持,而 Cargo 允许你执行以下任何测试: + +``` +$ cd libhello/ + +$ cat src/lib.rs +#[cfg(test)] +mod tests { +    #[test] +    fn it_works() { +        assert_eq!(2 + 2, 4); +    } +} +``` + +Cargo 有一个方便的 `test` 命令,可以运行代码中存在的任何测试。尝试默认运行 Cargo 在库代码中放入的测试: + +``` +$ cargo test +   Compiling libhello v0.1.0 (/opensource/libhello) +    Finished test [unoptimized + debuginfo] target(s) in 0.55s +     Running target/debug/deps/libhello-d52e35bb47939653 + +running 1 test +test tests::it_works ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out + +   Doc-tests libhello + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out +``` + +### 深入了解 Cargo 内部 + +你可能有兴趣了解在运行一个 Cargo 命令时它底下发生了什么。毕竟,在许多方面,Cargo 只是个封装器。要了解它在做什么,你可以将 `-v` 选项与任何 Cargo 命令一起使用,以将详细信息输出到屏幕。 + +这是使用 `-v` 选项运行 `build` 和 `clean` 的几个例子。 + +在 `build` 命令中,你可以看到这些给定的命令行选项触发了底层的 `rustc`(Rust编译器): + +``` +$ cargo build -v +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +     Running `rustc --edition=2018 --crate-name hello_opensource src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=147b8a0f466515dd -C extra-filename=-147b8a0f466515dd --out-dir /opensource/hello_opensource/target/debug/deps -C incremental=/opensource/hello_opensource/target/debug/incremental -L dependency=/opensource/hello_opensource/target/debug/deps` +    Finished dev [unoptimized + debuginfo] target(s) in 0.36s +``` + +而 `clean` 命令表明它只是删除包含中间文件和二进制文件的目录: + +``` +$ cargo clean -v +    Removing /opensource/hello_opensource/target +``` + +### 不要让你的技能生锈 + +要扩展你的技能,请尝试使用 Rust 和 Cargo 编写并运行一个稍微复杂的程序。很简单就可以做到:例如,尝试列出当前目录中的所有文件(可以用 9 行代码完成),或者尝试自己回显输入。小型的实践应用程序可帮助你熟悉语法以及编写和测试代码的过程。 + +本文为刚起步的 Rust 程序员提供了大量信息,以使他们可以开始入门 Cargo。但是,当你开始处理更大、更复杂的程序时,你需要对 Cargo 有更深入的了解。当你准备好迎接更多内容时,请下载并阅读 Rust 团队编写的开源《[Cargo 手册][10]》,看看你可以创造什么! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/rust-cargo + +作者:[Gaurav Kamathe][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/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-containers2.png?itok=idd8duC_ (Shipping containers stacked in a yard) +[2]: https://www.rust-lang.org/ +[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages +[4]: https://sh.rustup.rs/ +[5]: https://www.rust-lang.org/tools/install +[6]: https://doc.rust-lang.org/cargo/faq.html +[7]: mailto:user@mail.com +[8]: mailto:test@mail.com +[9]: http://crates.io +[10]: https://doc.rust-lang.org/cargo From 93c91e2a44ba0545b2eef72e4d30f13c83abdbfc Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Thu, 5 Mar 2020 22:15:55 +0800 Subject: [PATCH 218/260] hankchow translating --- ...rce Private Messenger That Doesn-t Need Your Phone Number.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md b/sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md index bc4dece67e..15529537a0 100644 --- a/sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md +++ b/sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d4e1dd002f90e8a196c5689ed339dd9f343f436f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 6 Mar 2020 00:52:25 +0800 Subject: [PATCH 219/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200306=20Three?= =?UTF-8?q?=20Ways=20to=20Exclude/Hold/Prevent=20a=20Specific=20Package=20?= =?UTF-8?q?from=20an=20apt=20Upgrade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md --- ... a Specific Package from an apt Upgrade.md | 190 ++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 sources/tech/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md diff --git a/sources/tech/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md b/sources/tech/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md new file mode 100644 index 0000000000..b4e47fcc36 --- /dev/null +++ b/sources/tech/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md @@ -0,0 +1,190 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Three Ways to Exclude/Hold/Prevent a Specific Package from an apt Upgrade) +[#]: via: (https://www.2daygeek.com/debian-ubuntu-exclude-hold-prevent-packages-from-apt-get-upgrade/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Three Ways to Exclude/Hold/Prevent a Specific Package from an apt Upgrade +====== + +Sometimes you may accidentally update packages that are not updated due to some application dependency. + +This is always the case during the entire system update or automatic package upgrade process. + +If this happens, it may break the application function. + +This creates a serious problem and you need to spend a lot of time fixing the problem. + +See the following article if you want to **[Exclude Specific Packages from Yum Update][1]** + +How to avoid this kind of situation? + +How do I exclude packages from apt-get update? + +Yes, it can be done using the following three methods on Debian and Ubuntu systems. + + * **[apt-mark Command][2]** + * **[dpkg Command][3]** + * aptitude Command + + + +We will show in detail each. + +### Method-1: How to Exclude Packages Update on Debian/Ubuntu System Using the apt-mark Command + +The apt-mark is used to mark/unmark a package as being automatically installed. + +The Hold option is used to mark a package as blocked, which prevents the package from being automatically installed, upgraded, or removed. + +The unhold option is used to cancel a previously set hold on a package to allow all actions to be repeated. + +Run the following command to hold the given package using the **apt-mark** command. + +``` +$ sudo apt-mark hold nano +nano set on hold. +``` + +Once you have hold some packages, run the following apt-mark command to view them. + +``` +$ sudo apt-mark showhold +nano +``` + +This will show that the **“nano”** package will not be upgraded when you perform a full system update. + +``` +$ sudo apt update + +Reading package lists… Done +Building dependency tree +Reading state information… Done +Calculating upgrade… Done +The following packages have been kept back: + nano +0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. +``` + +Run the following command to unhold the “nano” package using the apt-mark command. + +``` +$ sudo apt-mark unhold nano +Canceled hold on nano. +``` + +### Method-2: How to Exclude Packages Update on Debian/Ubuntu System Using the dpkg Command + +The dpkg command is a CLI tool to install, build, remove and manage Debian packages. The primary and more user-friendly front-end for dpkg is aptitude. + +Run the following command to block a given package using the dpkg command. + +**Syntax:** + +``` +$ echo "package_name hold" | sudo dpkg --set-selections +``` + +Run the below dpkg command to hold the **“apache2”** package. + +``` +$ echo "apache2 hold" | sudo dpkg --set-selections +``` + +Once you have hold some packages, run the following command to view them. + +``` +$ sudo dpkg --get-selections | grep "hold" +apache2 hold +``` + +It will show that the **“apache2”** package will not be upgraded when you perform a full system update. + +``` +$ sudo apt update + +Reading package lists… Done +Building dependency tree +Reading state information… Done +Calculating upgrade… Done +The following packages have been kept back: + apache2 +0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. +``` + +Run the following command to unhold the given package using the dpkg command. + +**Syntax:** + +``` +$ echo "package_name install" | sudo dpkg --set-selections +``` + +Run the following command to unhold the “apache2” package using the dpkg command. + +``` +$ echo "apache2 install" | sudo dpkg --set-selections +``` + +### Method-3: How to Exclude Packages Update on Debian/Ubuntu System Using the aptitude Command + +The aptitude command is a text-based package management interface to the Debian and it’s derivative. + +It allows the user to view a 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. + +Run the following command to hold the given package using the aptitude command. + +``` +$ sudo aptitude hold python3 +``` + +Once you have hold some packages, run the following aptitude command to view them. + +``` +$ sudo dpkg --get-selections | grep "hold" +or +$ sudo apt-mark showhold + +python3 +``` + +This will show that the **“python3”** package will not be upgraded when you perform a full system update. + +``` +$ sudo apt update + +Reading package lists… Done +Building dependency tree +Reading state information… Done +Calculating upgrade… Done +The following packages have been kept back: + python3 +0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. +``` + +Run the following command to unhold the **“python3”** package using the apt-mark command. + +``` +$ sudo aptitude unhold python3 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/debian-ubuntu-exclude-hold-prevent-packages-from-apt-get-upgrade/ + +作者:[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/redhat-centos-yum-update-exclude-specific-packages/ +[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/ From a81e47864ae9aadd7e554f4ffa6ac0cf10e29c10 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 6 Mar 2020 00:54:20 +0800 Subject: [PATCH 220/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200306=20What?= =?UTF-8?q?=20is=20Linux=20and=20Why=20There=20are=20100=E2=80=99s=20of=20?= =?UTF-8?q?Linux=20Distributions=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200306 What is Linux and Why There are 100-s of Linux Distributions.md --- ... There are 100-s of Linux Distributions.md | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 sources/tech/20200306 What is Linux and Why There are 100-s of Linux Distributions.md diff --git a/sources/tech/20200306 What is Linux and Why There are 100-s of Linux Distributions.md b/sources/tech/20200306 What is Linux and Why There are 100-s of Linux Distributions.md new file mode 100644 index 0000000000..be6a45e211 --- /dev/null +++ b/sources/tech/20200306 What is Linux and Why There are 100-s of Linux Distributions.md @@ -0,0 +1,193 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is Linux and Why There are 100’s of Linux Distributions?) +[#]: via: (https://itsfoss.com/what-is-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +What is Linux and Why There are 100’s of Linux Distributions? +====== + +When you are just starting with Linux, it’s easy to get overwhelmed. + +You probably know only Windows and now you want to use Linux because you read that [Linux is better than Windows][1] as it is more secure and you don’t have to buy a license to use Linux. + +But then when you go about downloading and installing Linux, you learn that Linux is not a single entity. There are [Ubuntu][2], [Fedora][3], [Linux Mint][4], elementary and hundreds of such ‘Linux variants’. The trouble is that some of them look just like the other. + +If that’s the case, why are there multiple of those Linux operating systems? And then you also learn that Linux is just a kernel not an operating system. + +![Too Many Linux!][5] + +It gets messy. And you may feel like pulling out your hair. For a person who has a receding hairline, I would like you to keep your hair intact by explaining things in a way you could easily understand. + +I am going to take an analogy and explain why Linux is just a kernel, why there are hundreds of Linux and why, despite looking similar, they are different. + +The explanation here may not be considered good enough for an answer in an exam or interview but it should give you a better understanding of the topic. + +Apology in advance! + +My analogy may not be entirely correct from mechanical point of view as well. I am not knowledgeable about engines, cars and other related mechanical stuff. +But in my experience, I have noticed that this analogy helps people clearly understand the concept of Linux and operating system. +Also, I have used the term Linux OS instead of Linux distribution deliberately so that newcomers don’t start wondering about distribution. + +### Linux is just a kernel + +_**Linux is not an operating system, it’s just a kernel.**_ + +The statement is entirely true. But how do you understand it. If you look into books, you’ll find Linux kernel structure described like this: + +![Linux Kernel Structure][6] + +There is absolutely correct, however, let’s take a different approach. Think of operating systems as vehicles, any kind of vehicle be it motorbikes, cars or trucks. + +What is at the core of a vehicle? An engine. + +Think of kernel as the engine. It’s an essential part of the vehicle and you cannot use a vehicle without the engine. + +![The Operating System Analogy][7] + +But you cannot drive an engine, can you? You need a lot of other stuff to interact with the engine and drive the vehicle. You need wheels, steering, gears, clutch, brakes and more to drive a vehicle on top of that engine. + +Similarly, you cannot use a kernel on its own. You need lots of tool to interact with the kernel and use the operating system. These stuff could be shell, commands, graphical interface (also called desktop environments) etc. + +This makes sense, right? Now that you understand this analogy, let’s take it further so that you understand the rest of it. + +Windows and other operating systems have kernel too + +Kernel is not something exclusive to Linux. You may not have realized but Windows, macOS and other operating systems have a kernel underneath as well. +Microsoft Windows operating systems are based on [Windows NT kernel][8]. Apple’s macOS is based on the [XNU kernel][9]. + +### Think of operating systems as vehicles + +Think of Microsoft as an automobile company that makes a general purpose car (Windows operating system) that is hugely popular and dominates the car market. They use their own patented engine that no one else can use. But these ‘Microsoft cars’ do not offer scope of customization. You cannot modify the engine on your own. + +Now come to ‘Apple automobile’. They offer shiny looking, luxury cars at an expensive price. If you got a problem, they have a premium support system where they might just replace the car. + +Now comes Linux. Remember, Linux is just an engine (kernel). But this ‘Linux engine’ is not patented and thus anyone is free to modify and build cars (desktop operating system), bikes (small embed system in your toys, tvs etc), trucks (servers) or jet-planes ([supercomputers][10]) on top of it. In real world, no such engine exists but accept it for the sake of this analogy. + +![][11] + + * kernel = engine + * Linux kernel = specific type of engine + * desktop operating systems = cars + * server operating systems = heavy trucks + * embed systems = motor-bikes + * desktop environment = body of the vehicle along with interiors (dashboard and all) + * themes and icons = paint job, rim job and other customization + * applications = accessories you put for specific purpose (like music system) + + + +### Why there are so many Linux OS/distributions? Why some look similar? + +Why there are so many cars? Because there are several vehicle manufacturers using the ‘Linux engine’ and each of them have so many cars of different type and for different purposes. + +Since ‘Linux engine’ is free to use and modify, anyone can use it to build a vehicle on top of it. + +This is why Ubuntu, Debian, Fedora, SUSE, [Manjaro][12] and many other **Linux-based operating systems (also called Linux distributions or Linux distros)** exist. + +You might also have noticed that these Linux operating systems offer different variants but they look similar. I mean look at Fedora’s default GNOME version and Debian’s GNOME version. They do look the same, don’t they? + +![Fedora GNOME vs Debian GNOME: Virtually No Visual Difference][13] + +The component that gives the look and feel in a Linux OS is called [desktop environment][14]. In our analogy here, you can think of it as a combination of outer body and matching interiors. This is what provides the look and feel to your vehicle, does it not? + +It’s from the exterior that you can identify the cars into category of sedan, SUV, hatchback, station wagon, convertible, minivan, van, compact car, 4×4 etc. + +But these ‘type of cars’ are not exclusive to a single automobile company. Ford offers SUV, compact cars, vans etc and so do other companies like General Motors, Toyota. + +![Vehicles of same type look similar even if they are from different automobile companies][15] + +Similarly, distributions (Linux OSes) like Fedora, Ubuntu, Debian, Manjaro etc also offer different variants in the form of GNOME, KDE, Cinnamon, MATE and other [desktop environments][16]. + +Ford’s SUV may look similar to Toyota’s or Renault’s SUV. Fedora’s GNOME version may look similar to Manjaro or Debian’s GNOME version. + +#### Some type of cars consume more fuel, some desktop environments need more RAM + +You probably understand the ‘usefulness’ of different types of cars. Compact cars are good for driving in the cities, vans are good for long trip with family, 4×4 are good for adventures in jungles and other rough terrain. A SUV may look good and feel comfortable for sitting but it consumes more fuel than a compact car that might not be comfortable to sit in. + +Similarly, desktop environments (GNOME, MATE, KDE, Xfce etc) also serve some purpose other than just providing the looks to your Linux operating system. + +GNOME gives a modern looking desktop but it consumes more RAM and thus require that your computer has more than 4 GB of RAM. Xfce on the other hand may look old/vintage but it can run on systems with 1 GB of RAM. + +#### Difference between getting desktop environment from distribution and installing on your own + +As you start using Linux, you’ll also come across suggestions that you can easily install other desktop environments on your current system. + +Remember that Linux is a free world. You are free to modify the engine, customize the looks on your own, if you have the knowledge/experience or if you are an enthusiastic learner. + +Think of it as customizing cars. You may modify a Hundai i20 to look like Suzuki Swift Dzire. But it might not be the same as using a Swift Dzire. + +When you are inside the i20 modified to look like Swiftz Dzire, you’ll find that it may not have the same experience from the inside. Dashboard is different, seats are different. You may also notice that the exterior doesn’t fit the same on i20’s body. + +The same goes for switching desktop environments. You will find that you don’t have the same set of apps in Ubuntu that you should be getting in Mint Cinnamon. Few apps will look out of place. Not to mention that you may find a few things broken, such as network manager indicator missing etc. + +Of course, you can put time, effort and skills to make Hundai i20 look as much like Swift Dzire as possible but you may feel like getting Suzuki Swift Dzire is a better idea in the first place. + +This is the reason why installing Ubuntu MATE is better than installing Ubuntu (GNOME version) and then [installing MATE desktop][17] on it. + +### Linux operating systems also differ in the way they handle applications + +Another major criteria on which the Linux operating systems differ from each other is the package management. + +Package management is basically how you get new software and updates in your systems. It’s up to your Linux distribution/OS to provide the security and maintenance updates. Your Linux OS also provides the means of installing new software on your system. + +Some Linux OS provides all the new software version immediately after their release while some take time to test them for your own good. Some Linux OS (like Ubuntu) provides easier way of installing a new software while you may find it complicated in some other Linux OS (like [Gentoo][18]). + +Keeping the line of our analogy, consider installing software as adding accessories to your vehicle. + +Suppose you have to install a music system in your car. You may have two options here. Your car is designed in such a way that you just insert the music player, you hear the click sound and you know it’s installed. The second option could be to get a screwdriver and then fix the music player on screws. + +Most people would prefer the hassle-free click lock installing system. Some people might take matter (and screwdriver) into their own hands. + +If an automobile company provides scope for installing lots of accessories in click-lock fashion in their cars, they will be preferred, won’t they? + +This is why Linux distributions like Ubuntu have a more users because they have a huge collection of software that can be easily installed in matter of clicks. + +### Conclusion + +Before I conclude this article, I’ll also like to talk about support that plays a significant role in choosing a Linux OS. For your car, you would like to have its official service center or other garages that service the automobile brand you own, don’t you? If the automobile company is popular, naturally, it will have more and more garages providing services. + +The same goes for Linux as well. For a popular Linux OS like Ubuntu, you have some official forums to seek support and a good number of websites and forums providing troubleshooting tips to fix your problem. + +Again, I know this is not a perfect analogy but this helps understand the things slightly better. + +If you are absolutely new to Linux, did this article made things clear for you or you are more confused than before? + +If you already know Linux, how would you explain Linux to someone from non-technical background? + +Your suggestions and feedback is welcome. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-is-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/linux-better-than-windows/ +[2]: https://ubuntu.com/ +[3]: https://getfedora.org/ +[4]: https://linuxmint.com/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/too-many-linux-choices.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Linux_Kernel_structure.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/operating_system_analogy.png?ssl=1 +[8]: https://en.wikipedia.org/wiki/Architecture_of_Windows_NT +[9]: https://en.wikipedia.org/wiki/XNU +[10]: https://itsfoss.com/linux-runs-top-supercomputers/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/linux-kernel-as-engine.png?ssl=1 +[12]: https://manjaro.org/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/fedora-gnome-vs-debian-gnome.jpg?ssl=1 +[14]: https://itsfoss.com/glossary/desktop-environment/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/linux_suv_analogy.jpg?ssl=1 +[16]: https://itsfoss.com/best-linux-desktop-environments/ +[17]: https://itsfoss.com/install-mate-desktop-ubuntu/ +[18]: https://www.gentoo.org/ From 8b898f553e50b5f67e627f6a127c0dc7aeb8d334 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 6 Mar 2020 00:56:58 +0800 Subject: [PATCH 221/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200305=205=20pr?= =?UTF-8?q?oductivity=20apps=20for=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200305 5 productivity apps for Linux.md --- .../20200305 5 productivity apps for Linux.md | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 sources/tech/20200305 5 productivity apps for Linux.md diff --git a/sources/tech/20200305 5 productivity apps for Linux.md b/sources/tech/20200305 5 productivity apps for Linux.md new file mode 100644 index 0000000000..3e7423dc59 --- /dev/null +++ b/sources/tech/20200305 5 productivity apps for Linux.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 productivity apps for Linux) +[#]: via: (https://opensource.com/article/20/3/productivity-apps-linux-elementary) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +5 productivity apps for Linux +====== +Get organized and accomplish more with these five productivity apps for +the Elementary Linux desktop. +![Person drinking a hat drink at the computer][1] + +I've had a soft spot for [Elementary OS][2] since I first encountered it in 2013. A lot of that has to do with the distribution being very clean and simple. + +Since 2013, I've recommended Elementary to people who I've helped [transition to Linux][3] from other operating systems. Some have stuck with it. Some who moved on to other Linux distributions told me that Elementary helped smooth the transition and gave them more confidence using Linux. + +Like the distribution itself, many of the applications created specifically for Elementary OS are simple, clean, and useful. They can help boost your day-to-day productivity, too. + +### About "pay-what-you-want" apps + +Some apps in the Elementary AppCenter ask you to pay what you can. You're not obliged to pay to the full amount a developer asks for (or pay anything, for that matter). However, any money that changes hands goes to support the development of those apps. + +Three of the applications in this article—Quilter, Notes-up, and Envelope—are pay-what-you-want. If you find an app useful, I encourage you to send some money the developer's way. + +### Envelope + +Managing your budget should be simple. More than a few people, though, struggle with the task. That's where [Envelope][4] can help. While Envelope doesn't pack the features of something like [GnuCash][5], it's good enough for most of us. + +The app is built around the [envelope system][6] of personal and household budgeting. The first time you launch Envelope, you need to set up an account. You can do that manually, or you can import a [QIF][7] file containing financial information from another program. + +![Adding an account in Envelope][8] + +Either way, Envelope offers a set of categories (your envelopes). Add or delete categories as you see fit—for example, I don't own a car, so I deleted the Fuel category. + +From there, add transactions. Those can be your expenses or your income. Or both. + +![Entering a transaction in Envelope][9] + +Envelope gives you an overview of your spending and income. To get a more focused view of your budget, you can report on the current or previous month or a specific range of dates. + +### Notes-Up + +[Notes-Up][10]'s look and feel are reminiscent of note-taking tools like [Standard Notes][11], Simplenote, and the macOS Notes app. If you use any of them, switching to Notes-Up will be smooth and painless. Regardless, Notes-Up is easy to learn and use. + +![Notes-Up][12] + +Create a note and start typing. Notes-Up supports Markdown, making it easy to add formatting to your notes. + +![Taking notes in Notes-Up][13] + +If your Markdown is rusty, you can click the buttons on the toolbar to add formatting like lists; bold, italics, and strikethrough; code blocks; images; and more. You can also export your notes as PDF or Markdown files. + +Use Notes-Up for a while, and you'll wind up with a long list of notes. Organize them using _notebooks_. You can, for example, create personal, school, and work notebooks. On top of that, Notes-Up enables you to create sub-notebooks. Under my notebook for Opensource.com, for example, I have sub-notebooks for articles and the news roundups I curate. + +Notebooks not your thing? Then use tags to add keywords to your notes to make them easier to sort. + +### Yishu + +I do as much of my work as I can in [plain text][14]. That includes my task list. For that, I turn to a handy command-line application called [Todo.txt][15]. + +If you aren't comfortable working at the command line, then [Yishu][16] is for you. It has Todo.txt's key features but graphically on the desktop. + +![Yishu][17] + +When you first fire up Yishu, it asks you to open an existing Todo.txt file. If you have one, open it. Otherwise, create a task. That also creates a new file for your tasks. + +![Adding a task in Yishu][18] + +Your options are limited: a description of the task and a priority. You can also add a due date in the format _YYYY-MM-DD_—for example, _2020-02-17_. + +When you click **OK**, Yishu saves the file Todo.txt to your **/home** folder. That might not be where you want to store your tasks. You can tell Yishu to use another folder in its preferences. + +### Reminduck + +Chances are, your notifications and reminders are jarring. A piercing buzz, an annoying beep, a text box that appears when you least expect it. Why not add a bit of [calm][19] and a bit of whimsy to your reminders—with a duck? + +That's the idea behind [Reminduck][20]. It's a simple and fun way to tell yourself it's time to do, well, anything. + +Fire up the app and create a reminder. You can add a description, date, and time for the reminder to appear, and you can set it to repeat. Reminders can repeat after a number of minutes that you set or at specific times every day, week, or month. + +![Reminduck][21] + +You can set up more than one reminder. Reminduck organizes your reminders, and you can edit or delete them. + +![Reminduck reminders][22] + +When the reminder is triggered, a little message pops out of the notification area on the desktop along with a soft alert and an icon of a smiling duck. + +![Reminduck notification][23] + +### Quilter + +It's easy enough to write with [Markdown][24] in a plain old text editor. Some folks, though, prefer to work with a dedicated Markdown editor. On the Elementary OS desktop, one option is [Quilter][25]. + +![Quilter][26] + +Quilter is pretty basic. There's no toolbar to insert formatting; you have to add Markdown by hand. On the other hand, Quilter displays a running word count and an estimate of how long it will take to read what you're writing. + +![Quilter][27] + +The editor's options are few. There's a preview mode, and you can export your documents to PDF or HTML. The result of an export has the same look as a preview. That's not a bad thing. + +Quilter's other options include the ability to change the line spacing and margins, set the editor's font, as well as enable syntax highlighting and spell checking. It also has a mode that you can use to focus on a single line or a single paragraph while you're writing. + +### Final thoughts + +Sometimes, the best tools to boost your productivity are simple ones. Applications like the five above focus on doing one thing and doing it well. + +Envelope, Notes-Up, Yishu, Reminduck, and Quilter won't appeal to everyone. But if you use Elementary OS, give them a try. They can help you keep on track and do what you need to do. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/productivity-apps-linux-elementary + +作者:[Scott Nesbitt][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/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://elementary.io +[3]: https://opensource.com/article/18/12/help-non-techies +[4]: https://nlaplante.github.io/envelope/ +[5]: https://opensource.com/article/20/2/gnucash +[6]: https://en.wikipedia.org/wiki/Envelope_system +[7]: https://en.wikipedia.org/wiki/Quicken_Interchange_Format +[8]: https://opensource.com/sites/default/files/uploads/envelope-add-account.png (Adding an account in Envelope) +[9]: https://opensource.com/sites/default/files/uploads/envelope-entering-transaction.png (Entering a transaction in Envelope) +[10]: https://appcenter.elementary.io/com.github.philip-scott.notes-up/ +[11]: https://opensource.com/article/18/12/taking-notes-standard-notes +[12]: https://opensource.com/sites/default/files/uploads/notes-up-main-window.png (Notes-Up) +[13]: https://opensource.com/sites/default/files/uploads/notes-up-taking-note.png (Taking notes in Notes-Up) +[14]: https://plaintextproject.online +[15]: https://opensource.com/article/20/1/open-source-to-do-list +[16]: https://appcenter.elementary.io/com.github.lainsce.yishu/ +[17]: https://opensource.com/sites/default/files/uploads/yishu-task-list.png (Yishu) +[18]: https://opensource.com/sites/default/files/uploads/yishu-add-task.png (Adding a task in Yishu) +[19]: https://weeklymusings.net/weekly-musings-025 +[20]: https://appcenter.elementary.io/com.github.matfantinel.reminduck/ +[21]: https://opensource.com/sites/default/files/uploads/reminduck.png (Reminduck) +[22]: https://opensource.com/sites/default/files/uploads/remiunduck-reminders-list.png (Reminduck reminders) +[23]: https://opensource.com/sites/default/files/uploads/reminduck-notification.png (Reminduck notification) +[24]: https://opensource.com/article/19/8/markdown-beginners-cheat-sheet +[25]: https://appcenter.elementary.io/com.github.lainsce.quilter/ +[26]: https://opensource.com/sites/default/files/uploads/quilter.png (Quilter) +[27]: https://opensource.com/sites/default/files/uploads/quilter-editing.png (Quilter) From 3fd33c8ec7b9fca4b13f160daa6b00415a8e7960 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 6 Mar 2020 01:03:53 +0800 Subject: [PATCH 222/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200305=20Report?= =?UTF-8?q?:=20Most=20IoT=20transactions=20are=20not=20secure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200305 Report- Most IoT transactions are not secure.md --- ...t- Most IoT transactions are not secure.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/talk/20200305 Report- Most IoT transactions are not secure.md diff --git a/sources/talk/20200305 Report- Most IoT transactions are not secure.md b/sources/talk/20200305 Report- Most IoT transactions are not secure.md new file mode 100644 index 0000000000..96a2add2d7 --- /dev/null +++ b/sources/talk/20200305 Report- Most IoT transactions are not secure.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Report: Most IoT transactions are not secure) +[#]: via: (https://www.networkworld.com/article/3530476/report-most-iot-transactions-are-not-secure.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Report: Most IoT transactions are not secure +====== +Data gathered by security provider Zscaler shows that not only are most internet-of-things transactions unsecured, they are also unauthorized as IoT creeps in as shadow-IT devices. +Iot + +The majority of [Internet of Things (IoT)][1] transactions don’t use even basic security, and there is a great deal of unauthorized IoT taking place inside the perimeter of enterprise firewalls thanks to shadow IT, a new study finds. + +Security vendor Zscaler analyzed nearly 500 million IoT transactions from more than 2,000 organizations over a two-week period. [The survey][2] found 553 different IoT devices from more than 200 different manufacturers, many of which had their security turned off. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +The study was done on Zscaler’s own Internet Access security service. It found the rate of IoT growth to be explosive: When it first started monitoring IoT traffic in May 2019, IoT traffic generated by its enterprise customer base was 56 million IoT transactions per month. By February 2020, that number had soared to 33 million transactions _per day_, or one billion IoT transactions per month, a 1,500% increase. + +Zscaler is a bit generous in what it defines as enterprise IoT devices, from devices such as data-collection terminals, digital signage media players, industrial control devices, medical devices, to decidedly non-business devices like digital home assistants, TV set-top boxes, IP cameras, smart home devices, smart TVs, smart watches and even automotive multimedia systems. + +“What this tells us is that employees inside the office might be checking their nanny cam over the corporate network. Or using their Apple Watch to look at email. Or working from home, connected to the enterprise network, and periodically checking the home security system or accessing media devices,” the company said in its report. + +Which is typical, to be honest, and let (s)he who is without sin cast the first stone in that regard. What’s troubling is that roughly 83% of IoT-based transactions are happening over plaintext channels, while only 17% are using [SSL][4]. The use of plaintext is risky, opening traffic to packet sniffing, eavesdropping, man-in-the-middle attacks and other exploits. + +And there are a lot of exploits. Zscaler said it detects about 14,000 IoT-based malware exploits per month, a seven-fold increase over the previous year. + +“Folks can keep their smart watches, smart closets, and whatever else they think is making them smart. Banning devices is not going to be the answer here. The answer is changing up the narrative on how we think about IoT devices from a security and risk standpoint, and what expectations we put on manufacturers to increase the security posture of these devices,” wrote Deepen Desai, Zscaler’s vice president of security research in a [blog post][5]. + +Desai said the solution is “taking a [zero-trust][6] mentality.” It may be a buzzword but, “it’s about security people not trusting any person or device to touch the network—that is, until you know who the user is, what the device is, and whether that user and device are allowed to access the applications they’re trying to reach.” + +Naturally Zscaler sells such a solution, but he makes a valid point. This is an ages-old problem I have seen time and again; a hot new technology comes along, everyone rushes to embrace it, then they think about securing it later. IoT is no different. + +Whatever your device, at least go into the settings and turn on SSL. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3530476/report-most-iot-transactions-are-not-secure.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[2]: https://info.zscaler.com/resources-industry-iot-in-the-enterprise +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/2303073/lan-wan-what-is-transport-layer-security-protocol.html +[5]: https://www.zscaler.com/blogs/corporate/shining-light-shadow-iot-protect-your-organization +[6]: https://www.networkworld.com/article/3487720/the-vpn-is-dying-long-live-zero-trust.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From 4e8e207047dbf849e8af9952a0f77823c91cbffc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 6 Mar 2020 01:09:48 +0800 Subject: [PATCH 223/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200305=20Chines?= =?UTF-8?q?e=20auto=20giant=20Geely=20plans=20a=20private=20satellite=20ne?= =?UTF-8?q?twork=20to=20support=20autonomous=20vehicles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20200305 Chinese auto giant Geely plans a private satellite network to support autonomous vehicles.md --- ... network to support autonomous vehicles.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/talk/20200305 Chinese auto giant Geely plans a private satellite network to support autonomous vehicles.md diff --git a/sources/talk/20200305 Chinese auto giant Geely plans a private satellite network to support autonomous vehicles.md b/sources/talk/20200305 Chinese auto giant Geely plans a private satellite network to support autonomous vehicles.md new file mode 100644 index 0000000000..8bf990573e --- /dev/null +++ b/sources/talk/20200305 Chinese auto giant Geely plans a private satellite network to support autonomous vehicles.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Chinese auto giant Geely plans a private satellite network to support autonomous vehicles) +[#]: via: (https://www.networkworld.com/article/3530336/chinese-auto-giant-geely-plans-a-private-satellite-network-to-support-autonomous-vehicles.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Chinese auto giant Geely plans a private satellite network to support autonomous vehicles +====== +Geely is developing a satellite network to provide high-bandwidth wireless needed by on-board applications in self-driving vehicles. +Olivier Le Moal / Getty Images + +What does a large automaker that’s morphing into a mobile-technology company and heavily investing in autonomous vehicles need to add to its ecosystem? Probably connectivity, and that’s likely why Chinese car giant Geely says it will be building its own satellite data network. + +A need for “highly accurate, autonomous driving solutions,” is part of what’s driving the strategy, the company says in a [press release][1]. Geely – the largest car maker in China and whose assets include Volvo and a stake in Lotus – has begun building a test facility in Taizhou City where it will develop satellite models, the company says. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“The creation of a truly smart, three-dimensional mobility ecosystem,” as the company describes its Geespace project, will include precise navigation, cloud computing and high-speed Internet functions. Geely is investing $326 million in the project [according to Reuters][3], citing a statement from the company. + +Over-the-air updating of vehicle software is a principal reason data networks will become prevalent in automobile technology. Historically, car companies haven’t worried much about the speedy updating of end-user’s systems, in part because they’ve liked getting customers back into the dealership to upsell service options and pitch new cars. A leisurely software patch while the customer hangs around drinking warm coffee and watching daytime soaps suits that purpose. However, autonomous cars are a different story: The safety of self-driving cars can’t tolerate software vulnerabilities. + +Control over vehicle positioning also comes into play. Knowing where the car is and where obstacles are is more important than in traditional vehicles. Lane-change and accident avoidance, for example, are autonomous-vehicle features that require high levels of accuracy. + +“The Geespace low-orbit satellite network will offer much higher centimeter-accurate precision,” Geely says, comparing its proposed constellation with the U.S. government-owned Global Positioning System. + +Data processing, artificial intelligence and infotainment onboard the vehicles all need fat networks, too. Former Intel CEO Brian Krzanich [said at a talk I attended a few years ago][4] that he thought cars would soon create 4,000 GB of data per hour of driving because of the number of sensors, such as cameras, that they’ll be equipped with. + +[][5] + +The Geely private satellite network is the first of its kind for an industrial use and joins [a trend in private wireless networking][6]. Private, terrestrial 5G networks and private LTE networks allow companies to control their own data and uptime, rather than relying on service providers. Mercedes-Benz is reportedly working on a private 5G network for privacy and security. + +“As vehicles become more connected and integrated into the Internet of Things ecosystem, the demand for data has grown exponentially,” Geely says. + +Geely will begin launching the Geespace satellites by the end of 2020. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3530336/chinese-auto-giant-geely-plans-a-private-satellite-network-to-support-autonomous-vehicles.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: http://zgh.com/media-center/news/2020-03-03-1/?lang=en +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.reuters.com/article/geely-china-satellite-autonomous/chinas-geely-invests-326-mln-to-build-satellites-for-autonomous-cars-idUSL4N2AV45H +[4]: https://www.networkworld.com/article/3147892/one-autonomous-car-will-use-4000-gb-of-dataday.html +[5]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[6]: https://www.networkworld.com/article/3319176/private-5g-networks-are-coming.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From 3dbcc83a451c69459181255ad043942a3ac4c43e Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 6 Mar 2020 08:03:03 +0800 Subject: [PATCH 224/260] translating --- ...between uppercase and lowercase on the Linux command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200228 Converting between uppercase and lowercase on the Linux command line.md b/sources/tech/20200228 Converting between uppercase and lowercase on the Linux command line.md index a2819e3ff7..b830a88c9d 100644 --- a/sources/tech/20200228 Converting between uppercase and lowercase on the Linux command line.md +++ b/sources/tech/20200228 Converting between uppercase and lowercase on the Linux command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From be4d9c35dd6f1be786bdbfecadf6f342a6bec1ac Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 6 Mar 2020 09:32:59 +0800 Subject: [PATCH 225/260] PRF @geekpi --- ...oud with Fedora 31 and Nextcloud Server.md | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/translated/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md b/translated/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md index c5cd454f7d..7c7db7b186 100644 --- a/translated/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md +++ b/translated/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Build your own cloud with Fedora 31 and Nextcloud Server) @@ -38,7 +38,7 @@ # systemctl enable --now httpd ``` -接下来,允许 _HTTP_ 流量穿过防火墙: +接下来,允许 HTTP 流量穿过防火墙: ``` # firewall-cmd --permanent --add-service=http @@ -57,7 +57,7 @@ # systemctl enable --now mariadb ``` -现在,MariaDB 正在运行,你可以运行 _mysql_secure_installation_ 命令来保护它: +现在,MariaDB 正在运行,你可以运行 `mysql_secure_installation` 命令来保护它: ``` # mysql_secure_installation @@ -148,14 +148,14 @@ Thanks for using MariaDB! # unzip nextcloud-17.0.2.zip -d /var/www/html/ ``` -接下来,创建一个数据文件夹,并授予 Apache 对 _nextcloud_ 目录树的读写访问权限: +接下来,创建一个数据文件夹,并授予 Apache 对 `nextcloud` 目录树的读写访问权限: ``` # mkdir /var/www/html/nextcloud/data # chown -R apache:apache /var/www/html/nextcloud ``` -SELinux 必须配置为可与 Nextcloud 一起使用。基本命令如下所示,但在 nexcloud 安装中还有很多其他的命令,发布在这里:[Nextcloud SELinux 配置][6] +SELinux 必须配置为可与 Nextcloud 一起使用。基本命令如下所示,但在 nexcloud 安装中还有很多其他的命令,发布在这里:[Nextcloud SELinux 配置][6]。 ``` # semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?' @@ -172,7 +172,7 @@ SELinux 必须配置为可与 Nextcloud 一起使用。基本命令如下所示 #### 使用 Web 界面 -在你喜欢的浏览器中,访问 __ 并输入字段: +在你喜欢的浏览器中,访问 并输入字段: ![][7] @@ -186,14 +186,12 @@ SELinux 必须配置为可与 Nextcloud 一起使用。基本命令如下所示 ### 最后几点 - * 我使用的是 _http_ 协议,但是 Nextcloud 也可以在 _https_ 上运行。我可能会在以后的文章中写一篇有关保护 Nextcloud 的文章。 -  * 我禁用了 SELinux,但是如果配置它,你的服务器将更加安全。 -  * Nextcloud 的建议 PHP 内存限制为 512M。要更改它,请编辑 _/etc/php.ini_ 配置文件中的 _memory_limit_ 变量,然后重新启动 _httpd_ 服务。 -  * 默认情况下,只能使用 __ URL 访问 Web 界面。如果要允许使用其他域名访问,[你可编辑 _/var/www/html/nextcloud/config/config.php_ 来进行此操作][8]。\* 字符可用于绕过域名限制,并允许任何解析为服务器 IP 的 URL 访问。 +* 我使用的是 http 协议,但是 Nextcloud 也可以在 https 上运行。我可能会在以后的文章中写一篇有关保护 Nextcloud 的文章。 +* 我禁用了 SELinux,但是如果配置它,你的服务器将更加安全。 +* Nextcloud 的建议 PHP 内存限制为 512M。要更改它,请编辑 `/etc/php.ini` 配置文件中的 `memory_limit` 变量,然后重新启动 httpd 服务。 +* 默认情况下,只能使用 URL 访问 Web 界面。如果要允许使用其他域名访问,[你可编辑 /var/www/html/nextcloud/config/config.php 来进行此操作][8]。`*` 字符可用于绕过域名限制,并允许任何解析为服务器 IP 的 URL 访问。 - - -``` + ``` 'trusted_domains' => array ( 0 => 'localhost', @@ -208,7 +206,7 @@ via: https://fedoramagazine.org/build-your-own-cloud-with-fedora-31-and-nextclou 作者:[storyteller][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 bd5d2583e0098ca744e4ef5d160515cc1e46d998 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 6 Mar 2020 09:33:38 +0800 Subject: [PATCH 226/260] PUB @geekpi https://linux.cn/article-11964-1.html --- ...uild your own cloud with Fedora 31 and Nextcloud Server.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md (99%) diff --git a/translated/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md b/published/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md similarity index 99% rename from translated/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md rename to published/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md index 7c7db7b186..295e111690 100644 --- a/translated/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md +++ b/published/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11964-1.html) [#]: subject: (Build your own cloud with Fedora 31 and Nextcloud Server) [#]: via: (https://fedoramagazine.org/build-your-own-cloud-with-fedora-31-and-nextcloud-server/) [#]: author: (storyteller https://fedoramagazine.org/author/storyteller/) From 4bc2d382657d6716756c220b52d4f40e06f7e015 Mon Sep 17 00:00:00 2001 From: messon007 <306809057@qq.com> Date: Fri, 6 Mar 2020 10:26:06 +0800 Subject: [PATCH 227/260] Update 20200204 DevOps vs Agile- What-s the difference.md Translating by messon007 --- sources/tech/20200204 DevOps vs Agile- What-s the difference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200204 DevOps vs Agile- What-s the difference.md b/sources/tech/20200204 DevOps vs Agile- What-s the difference.md index ec49c22c92..d83e9c17f7 100644 --- a/sources/tech/20200204 DevOps vs Agile- What-s the difference.md +++ b/sources/tech/20200204 DevOps vs Agile- What-s the difference.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (messon007) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From eb44cdacedfb210887e2e4395945f399761da29c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 6 Mar 2020 10:47:38 +0800 Subject: [PATCH 228/260] Rename sources/tech/20200306 What is Linux and Why There are 100-s of Linux Distributions.md to sources/talk/20200306 What is Linux and Why There are 100-s of Linux Distributions.md --- ...hat is Linux and Why There are 100-s of Linux Distributions.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200306 What is Linux and Why There are 100-s of Linux Distributions.md (100%) diff --git a/sources/tech/20200306 What is Linux and Why There are 100-s of Linux Distributions.md b/sources/talk/20200306 What is Linux and Why There are 100-s of Linux Distributions.md similarity index 100% rename from sources/tech/20200306 What is Linux and Why There are 100-s of Linux Distributions.md rename to sources/talk/20200306 What is Linux and Why There are 100-s of Linux Distributions.md From 64b6658edee78c40545a7da5be45aeb5531950a9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 6 Mar 2020 11:38:08 +0800 Subject: [PATCH 229/260] translated --- .../20200302 Install GNU Emacs on Windows.md | 102 ------------------ .../20200302 Install GNU Emacs on Windows.md | 99 +++++++++++++++++ 2 files changed, 99 insertions(+), 102 deletions(-) delete mode 100644 sources/tech/20200302 Install GNU Emacs on Windows.md create mode 100644 translated/tech/20200302 Install GNU Emacs on Windows.md diff --git a/sources/tech/20200302 Install GNU Emacs on Windows.md b/sources/tech/20200302 Install GNU Emacs on Windows.md deleted file mode 100644 index 7ba0e633bb..0000000000 --- a/sources/tech/20200302 Install GNU Emacs on Windows.md +++ /dev/null @@ -1,102 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Install GNU Emacs on Windows) -[#]: via: (https://opensource.com/article/20/3/emacs-windows) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Install GNU Emacs on Windows -====== -Even if your operating system is closed source, you can still use this -popular open source text editor. -![Tall building with windows][1] - -GNU Emacs is a popular text editor designed for programmers of all sorts. Because it was developed on Unix and is widely used on Linux (and shipped with macOS), people sometimes don't realize that it's also available for Microsoft Windows. You don't need to be an experienced or full-time programmer to make use of Emacs, either. You can download and install Emacs with just a few clicks, and this article shows you how. - -You can install Windows manually or with a package manager, like [Chocolatey][2]. - -### 7-zip - -If you haven't already installed 7-zip for Windows, you should do that first. [7-zip][3] is an open source archive utility with the ability to create and extract ZIP, 7z, TAR, XZ, BZIP2, and GZIP (and more) files. It's an invaluable tool for Windows users. - -After installing 7-zip, you have new 7-zip archive options in your right-click menu when browsing files in Windows Explorer. - -### Powershell and Chocolatey - -To install GNU Emacs on Windows using Chocolatey: - - -``` -`PS> choco install emacs-full` -``` - -Once it has installed, launch Emacs from Powershell: - - -``` -`PS> emacs` -``` - -![Emacs running on Windows][4] - -### Download GNU Emacs for Windows - -To manually install GNU Emacs on Windows, you must [download Emacs][5]. - -![GNU Windows downloader][6] - -This takes you to a server near you, which shows you a list of all available Emacs releases. Find the directory with the highest release number and click into it. There are many different builds of Emacs for Windows, but the most general-purpose version is just named **emacs-VERSION-ARCHITECTURE.zip**. The **VERSION** depends upon which release you're downloading, while the **ARCHITECTURE** depends on whether you have a 32-bit or 64-bit machine. Most modern computers are 64-bit, but if you're in doubt you can download the 32-bit version, which runs on both. - -If you're downloading version 26 of Emacs for a 64-bit machine, you would click the link titled **emacs-26.2-x86_64.zip**. There are smaller downloads available (such as the **no-deps** variety) but you must be familiar with how Emacs is built from source code, knowing which libraries it needs and which of those your computer has on it already. Generally, it's easiest to get the large version of Emacs, because it contains everything it needs to run on your computer. - -### Extract Emacs - -Next, unarchive the ZIP file you downloaded. To extract it, right-click on the Emacs ZIP file and select **Extract to Emacs-VERSION** from the 7-zip sub-menu. It's a big archive, so it may take a while to uncompress, but when it does, you have a new directory containing all the files distributed with Emacs. For example, in this example, the file **emacs-26.2-x86_64.zip** was downloaded, so the unarchived directory is **emacs-26.2-x86_64**. - -### Launch Emacs - -Within the Emacs directory, find the **bin** directory. This folder stores all the binary executable files (EXE files) distributed with Emacs. Double-click the **emacs.exe** file to launch the application. - -![Emacs running on Windows][7] - -You can create a shortcut to **emacs.exe** on your desktop for easier access. - -### Learn Emacs - -Emacs isn't as obtuse as its reputation may indicate. It's got its own traditions and conventions, but when you're typing text into it, you can treat it exactly as you treat Notepad or any given text field on any given website. - -The important differences occur when you _edit_ the text you've typed. - -The only way to learn is to start using it, though, so make Emacs your go-to text editor for simple tasks. When you'd normally open Notepad or Word or Evernote or whatever it is you use for quick notes or as a temporary scratchpad, launch Emacs instead. - -Emacs has the reputation of being a terminal-based application, but obviously it has a GUI, so use the GUI often, just as you would with any application. Copy, cut, and paste (or "yank" in Emacs terminology) from the menu instead of with the keyboard, and open and save files from the menu or toolbar. Start from the beginning and learn the application based on what it is and not how you think it should act based on your experience with other editors. - -### Download our [cheatsheet][8]! - -_Thanks to Matthias Pfuetzner and Stephen Smoogen._ - -These are Jimmy's six favorite open source applications that he immediately installs on a new... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/3/emacs-windows - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/windows_building_sky_scale.jpg?itok=mH6CAX29 (Tall building with windows) -[2]: https://github.com/chocolatey/choco -[3]: https://www.7-zip.org/ -[4]: https://opensource.com/sites/default/files/uploads/windows-ps-choco-emacs.jpg (Emacs running on Windows) -[5]: https://www.gnu.org/software/emacs/download.html -[6]: https://opensource.com/sites/default/files/uploads/windows-emacs-download.jpg (GNU Windows downloader) -[7]: https://opensource.com/sites/default/files/uploads/windows-emacs.jpg (Emacs running on Windows) -[8]: https://opensource.com/downloads/emacs-cheat-sheet diff --git a/translated/tech/20200302 Install GNU Emacs on Windows.md b/translated/tech/20200302 Install GNU Emacs on Windows.md new file mode 100644 index 0000000000..3ef9810f0c --- /dev/null +++ b/translated/tech/20200302 Install GNU Emacs on Windows.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Install GNU Emacs on Windows) +[#]: via: (https://opensource.com/article/20/3/emacs-windows) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +在 Windows 上安装 GNU Emacs +====== +即使你的操作系统是闭源的,你仍然可以使用这个流行的开源文本编辑器。 +![Tall building with windows][1] + +GNU Emacs 是一个专为各种程序员设计的流行的文本编辑器。因为它是在 Unix 上开发的,并在 Linux(macOS 中也有)上得到了广泛使用,所以人们有时没有意识到它也可用于 Microsoft Windows 上。你也无需成为有经验的或专职的程序员即可使用 Emacs。只需单击几下就可以下载并安装 Emacs,本文向你展示了如何进行。 + +你可以手动安装 Windows,也可以使用包管理器安装,例如 [Chocolatey][2]。 + +### 7-zip + +如果还没在 Windows 中安装 7-zip,那么就先安装它。[7-zip][3] 是一个开源的存档程序,能够创建和解压 ZIP、7z、TAR、XZ、BZIP2 和 GZIP(以及更多)文件。对于 Windows 用户来说,这是一个宝贵的工具。 + +安装 7-zip 后,在 Windows 资源管理器中浏览文件时,右键单击菜单中就有新的 7-zip 存档选项。 + +### Powershell 和 Chocolatey + +要在 Windows 上使用 Chocolatey 安装 GNU Emacs : + + +``` +`PS> choco install emacs-full` +``` + +安装后,在 Powershell 中启动 Emacs: + + +``` +`PS> emacs` +``` + +![Emacs running on Windows][4] + +### 下载适用于 Windows 的 GNU Emacs + +要在 Windows 上手动安装 GNU Emacs,你必须[下载 Emacs][5]。 + +![GNU Windows downloader][6] + +它会打开连接到离你最近的服务器,并展示所有可用的 Emacs 版本。找到发行版本号最高的目录,然后单击进入。Windows 有许多不同的 Emacs 构建,但是最通用的版本只是被命名为 emacs-VERSION-ARCHITECTURE.zip。**VERSION** 取决于你要下载的版本,而 **ARCHITECTURE** 取决于你使用的是 32 位还是 64 位计算机。大多数现代计算机都是 64 位的,但是如果你有疑问,可以下载 32 位版本,它可在两者上运行。 + +如果要下载 64 位计算机的 Emacs v26,你应该点击 emacs-26.2-x86_64.zip 的链接。有较小的下载包(例如 “no-deps” 等),但是你必须熟悉如何从源码构建 Emacs,知道它需要哪些库以及你的计算机上已经拥有哪些库。通常,获取较大版本的 Emacs 最容易,因为它包含了在计算机上运行所需的一切。 + +### 解压 Emacs + +接下来,解压下载的 ZIP 文件。要解压缩,请右键单击 Emacs ZIP 文件,然后从 7-zip 子菜单中选择 **Extract to Emacs-VERSION**。这是一个很大的压缩包,因此解压可能需要一段时间,但是完成后,你将拥有一个新目录,其中包含与 Emacs 一起分发的所有文件。例如,在此例中,下载了 emacs-26.2-x86_64.zip,因此解压后的目录为 emacs-26.2-x86_64。 + +### 启动 Emacs + +在 Emacs 目录中,找到 **bin** 目录。此文件夹存储随 Emacs 一起分发的所有二进制可执行文件(EXE 文件)。双击 emacs.exe 文件启动应用。 + +![Emacs running on Windows][7] + +你可以在桌面上创建 **emacs.exe** 的快捷方式,以便于访问。 + +### 学习 Emacs + +Emacs 并不像传闻那样难用。它具有自己的传统和惯例,但是当你其中输入文本时,你可以像在记事本或者网站的文本框中那样使用它。 + +重要的区别是在你_编辑_输入的文本时。 + +但是,学习的唯一方法是开始使用它,因此,使 Emacs 成为完成简单任务的首选文本编辑器。当你通常打开记事本、Word 或 Evernote 或其他工具来做快速笔记或临时记录时,请启动 Emacs。 + +Emacs 以基于终端的应用而闻名,但它显然有 GUI,因此请像使用其他程序一样经常使用它的 GUI。从菜单而不是使用键盘复制、剪切和粘贴(paste)(或用 Emacs 的术语 “yank”),然后从菜单或工具栏打开和保存文件。从头开始,并根据应用本身来学习它,而不是根据你以往对其他编辑器的经验就认为它应该是怎样。 + +### 下载[速查表][8]! + +_感谢 Matthias Pfuetzner 和 Stephen Smoogen。_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/emacs-windows + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/windows_building_sky_scale.jpg?itok=mH6CAX29 (Tall building with windows) +[2]: https://github.com/chocolatey/choco +[3]: https://www.7-zip.org/ +[4]: https://opensource.com/sites/default/files/uploads/windows-ps-choco-emacs.jpg (Emacs running on Windows) +[5]: https://www.gnu.org/software/emacs/download.html +[6]: https://opensource.com/sites/default/files/uploads/windows-emacs-download.jpg (GNU Windows downloader) +[7]: https://opensource.com/sites/default/files/uploads/windows-emacs.jpg (Emacs running on Windows) +[8]: https://opensource.com/downloads/emacs-cheat-sheet From 2c12683835505475605f02f6c8d0161bdc3b35e6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 6 Mar 2020 11:39:16 +0800 Subject: [PATCH 230/260] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @heguangzhi 翻译完再检查一遍会更好 --- ...t you-re looking for on Linux with find.md | 103 +++++++++--------- 1 file changed, 49 insertions(+), 54 deletions(-) diff --git a/translated/tech/20200219 How to find what you-re looking for on Linux with find.md b/translated/tech/20200219 How to find what you-re looking for on Linux with find.md index f54e9a3924..a6d515943e 100644 --- a/translated/tech/20200219 How to find what you-re looking for on Linux with find.md +++ b/translated/tech/20200219 How to find what you-re looking for on Linux with find.md @@ -1,42 +1,40 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to find what you’re looking for on Linux with find) [#]: via: (https://www.networkworld.com/article/3527420/how-to-find-what-you-re-looking-for-on-linux-with-find.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -如何在 Linux上通过 find 命令找到你要找的东西 +通过 find 命令找到你要找的东西 ====== -find 命令有大量选项可以帮助你准确定位你在 Linux 系统上需要寻找的文件。这篇文章讨论了一系列非常有用的选项。 -CSA 图片/ Getty 图片 +> find 命令有巨多的选项可以帮助你准确定位你在 Linux 系统上需要寻找的文件。这篇文章讨论了一系列非常有用的选项。 -在 Linux 系统上有许多用于查找文件的命令,但是在查找文件时也有大量的选项可以选择。 +![](https://img.linux.net.cn/data/attachment/album/202003/06/113842txki5llopb5aagbt.jpg) + +在 Linux 系统上有许多用于查找文件的命令,而你在使用它们时也有巨多的选项可以使用。 例如,你不仅可以通过文件的名称来查找文件,还可以通过文件的所有者或者组、它们的创建时间、大小、分配的权限、最后一次访问它们的时间、关联的信息节点,甚至是文件是否属于系统上不再存在的帐户或组等等来查找文件。 -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] 你还可以指定搜索从哪里开始,搜索应该深入到文件系统的什么位置,以及搜索结果将告诉你它所找到的文件的数量。 -而所有这些要求都可以通过 **find** 命令来处理。 +而所有这些要求都可以通过 `find` 命令来处理。 -下面提供了根据这些标准查找文件的示例。在某些命令中,错误(例如试图列出你没有读取权限的文件),错误输出将被发送到 **/dev/null**,以便我们不必查看它。在其他情况下,我们将简单地以 root 身份运行以避免这个问题。 +下面提供了根据这些要求查找文件的示例。在某些命令中,错误(例如试图列出你没有读取权限的文件)输出将被发送到 `/dev/null`,以便我们不必查看它。或者,我们可以简单地以 root 身份运行以避免这个问题。 -请记住,还其他选项存在。这篇文章涵盖了很多内容,但并不是 **find** 命令帮助你定位查找文件的所有方式。 +请记住,还有更多的其他选项。这篇文章涵盖了很多内容,但并不是 `find` 命令帮助你定位查找文件的所有方式。 ### 选择起点 -使用 **find**,您可以选择一个起点或从你所在的位置开始。请在单词“find”后输入要选择起点。例如,“find /usr” 或 “find ./bin "将在 **/usr** 目录或 **bin** 目录开始搜索,而" find ~ " 将在你的主目录中开始,即使你位于当前文件系统中的其他位置。 +使用 `find`,你可以选择一个起点或从你所在的位置开始。要选择的搜索的起点,请在单词 `find` 后输入它。例如,`find /usr` 或 `find ./bin` 将在 `/usr` 目录或当前位置下的 `bin` 目录开始搜索,而 `find ~` 将在你的主目录中开始搜索,即使你当前位于当前文件系统中的其他位置。 -[][2] +### 选择你要找的 -### 选择你想看的 +最常用的搜索策略之一是按名称搜索文件。这需要使用 `-name` 选项。 -最常用的搜索策略之一是按名称搜索文件。这需要使用 **-name** 选项。 - -默认情况下,**查找** 会显示找到的文件的完整路径。如果你在命令中添加 **-print**,你会看到同样的情况。如果你想查看与文件相关的详细信息—-例如:文件的长度、权限等,您需要在你的 **查找** 命令的末尾添加 **-ls** 命令。 +默认情况下,`find` 会显示找到的文件的完整路径。如果你在命令中添加 `-print`,你会看到同样的结果。如果你想查看与文件相关的详细信息—-例如:文件的长度、权限等,你需要在你的 `find` 命令的末尾添加 `-ls` 参数。 ``` $ find ~/bin -name tryme @@ -47,18 +45,17 @@ $ find ~/bin -name tryme -ls 917528 4 -rwx------ 1 shs shs 139 Apr 8 2019 /home/shs/bin/tryme ``` -你也可以使用子字符串来查找文件。例如,如果你将上面示例中的“tryme”替换为“try*”,你将会找到所有名称以“try”开头的文件。 +你也可以使用子字符串来查找文件。例如,如果你将上面示例中的 `tryme` 替换为 `try*`,你将会找到所有名称以 `try` 开头的文件。(LCTT 译注:如果要使用通配符 `*` ,请将搜索字符串放到单引号或双引号内,以避免通配符被 shell 所解释) -按名称查找文件可能是 **find** 命令最典型的用法,但是有很多其他的方式来查找文件,并且有很好的理由这样做。下面的部分展示了如何使用其他可用的方式。 +按名称查找文件可能是 `find` 命令最典型的用法,不过还有很多其他的方式来查找文件,并且有这样做的需要。下面的部分展示了如何使用其他可用的方式。 -此外,当按大小、组、索引节点等条件来搜索文件时,你需要确认找到的文件与你要查找的文件是否相匹配。使用 **-ls** 选项来显示细节是非常有用。 +此外,当按文件大小、组、索引节点等条件来搜索文件时,你需要确认找到的文件与你要查找的文件是否相匹配。使用 `-ls` 选项来显示细节是非常有用。 ### 通过大小查找文件 -按大小查找文件需要使用 **-size** 选项并且对相应规范使用一点技巧。如果你指定 **-size 189b**,例如,你将找到189个块长的文件,而不是189个字节。对于字节,你需要使用 **--size 189c**(字符)。而且,如果你指定 **--size 200w** ,你将会找到200个单词的文件——以“双字节增量”为单位的单词,而不是“我们彼此都在说的那些事情”中的单词。你还可以通过以千字节(k)、兆字节(M)和千兆字节(G)为单位提供大小来查找文件。 +按大小查找文件需要使用 `-size` 选项并且对相应规范使用一点技巧。例如,如果你指定 `-size 189b`,你将找到 189 个块大小的文件,而不是 189 个字节。(LCTT 译注:如果不跟上单位,默认单位是 `b`。一个块是 512 个字节大小,不足或正好 512 个字节将占据一个块。)对于字节,你需要使用 `--size 189c`(字符)。而且,如果你指定 `--size 200w` ,你将会找到 200 个“word”的文件——以“双字节增量”为单位的字,而不是“我们互相谈论的那些事情”中的单词。你还可以通过以千字节(`k`)、兆字节(`M`)和千兆字节(`G`)为单位提供大小来查找文件。(LCTT 译注:乃至还有 `T`、`P`) - -大多数情况下,Linux用户会搜索比所选文件大的文件。例如,要查找大于1千兆字节的文件,你可以使用这样的命令,其中 +1G 表示“大于1千兆字节”: +大多数情况下,Linux 用户会搜索比选定大小要大的文件。例如,要查找大于 1 千兆字节的文件,你可以使用这样的命令,其中 `+1G` 表示“大于 1 千兆字节”: ``` $ find -size +1G -ls 2>/dev/null @@ -66,9 +63,9 @@ $ find -size +1G -ls 2>/dev/null 801834 1052556 -rw-rw-r-- 1 shs shs 1077809525 Dec 21 2018 ./2019/hold.zip ``` -### 通过索引节点查找文件 # +### 通过索引节点号查找文件 -你可以通过用于维护文件元数据(即除文件内容和文件名之外的所有内容)的索引节点来查找文件。 +你可以通过用于维护文件元数据(即除文件内容和文件名之外的所有内容)的索引节点来查找文件。 ``` $ find -inum 919674 -ls 2>/dev/null @@ -77,14 +74,14 @@ $ find -inum 919674 -ls 2>/dev/null ### 查找具有特定文件所有者或组的文件 -按所有者或组查找文件也非常简单。这里我们使用 sudo 来解决权限问题。 +按所有者或组查找文件也非常简单。这里我们使用 `sudo` 来解决权限问题。 ``` -$ sudo find /home -user nemo -name "*.png"-ls +$ sudo find /home -user nemo -name "*.png" -ls 1705219 4 drwxr-xr-x 2 nemo nemo 4096 Jan 28 08:50 /home/nemo/Pictures/me.png ``` -在这个命令中,我们寻找一个被称为 “admins” 的多用户组拥有的文件。 +在下面这个命令中,我们寻找一个被称为 `admins` 的多用户组拥有的文件。 ``` # find /tmp -group admins -ls @@ -93,18 +90,18 @@ $ sudo find /home -user nemo -name "*.png"-ls ### 查找没有所有者或组的文件 -你可以使用如下命令所示的 **-nouser** 选项来查找系统上没有任何现存用户属性的文件。 +你可以使用如下命令所示的 `-nouser` 选项来查找不属于当前系统上的任何用户的文件。 ``` # find /tmp -nouser -ls 262204 4 -rwx------ 1 1016 1016 17 Feb 17 16:42 /tmp/hello ``` -请注意,该列表显示了旧用户的 UID 和 GID,这清楚地表明该用户未在系统上定义。这种命令将查找由于帐户已从系统中删除的用户在非主目录中创建的文件,或者在用户帐户被删除后未被删除的主目录中创建的文件。类似地,**-nogroup** 选项会找到这样的文件,尤其是当这些用户是相关组的唯一成员时。 +请注意,该列表显示了旧用户的 UID 和 GID,这清楚地表明该用户未在系统上定义。这种命令将查找帐户已从系统中删除的用户创建在主目录之外的文件,或者在用户帐户被删除后而未被删除的主目录中创建的文件。类似地,`-nogroup` 选项也会找到这样的文件,尤其是当这些用户是相关组的唯一成员时。 ### 按上次更新时间查找文件 -在此命令中,我们在特定用户的主目录中查找过去24小时内更新过的文件。**sudo** 用于搜索另一个用户的主目录。 +在此命令中,我们在特定用户的主目录中查找过去 24 小时内更新过的文件。`sudo` 用于搜索另一个用户的主目录。 ``` $ sudo find /home/nemo -mtime -1 @@ -115,18 +112,18 @@ $ sudo find /home/nemo -mtime -1 ### 按上次更改权限的时间查找文件 -**-ctime** 选项可以帮助你查找在某个参考时间范围内状态(如权限)发生更改的文件。以下是查找在最后一天内权限发生更改的文件的示例: +`-ctime` 选项可以帮助你查找在某个参考时间范围内状态(如权限)发生更改的文件。以下是查找在最后一天内权限发生更改的文件的示例: ``` $ find . -ctime -1 -ls 787987 4 -rwxr-xr-x 1 shs shs 189 Feb 11 07:31 ./tryme ``` -请记住,显示的日期和时间反映了文件内容的最后更新。你需要使用像 **stat** 这样的命令来查看与文件相关联的三个状态(文件创建、修改和状态更改)。 +请记住,显示的日期和时间只反映了对文件内容进行的最后更新。你需要使用像 `stat` 这样的命令来查看与文件相关联的三个状态(文件创建、修改和状态更改)。 -### Finding files based on last access times +### 按上次访问的时间查找文件 -在这个命令中,我们使用 **-atime** 选项查找在过去两天内访问过的本地 pdf 文件。 +在这个命令中,我们使用 `-atime` 选项查找在过去两天内访问过的本地 pdf 文件。 ``` $ find -name "*.pdf" -atime -2 @@ -135,7 +132,7 @@ $ find -name "*.pdf" -atime -2 ### 根据文件相对于另一个文件的时间来查找文件 -你可以使用 -newer 选项来查找比其他文件更新的文件。 +你可以使用 `-newer` 选项来查找比其他文件更新的文件。 ``` $ find . -newer dig1 -ls @@ -144,23 +141,23 @@ $ find . -newer dig1 -ls 791846 4 -rw-rw-r-- 1 shs shs 649 Feb 13 14:26 ./dig ``` -没有相应的 **-older** 选项,但是你可以用**,得到类似的结果 **! -newer**(即更旧),这意味着几乎相同的事情。 +没有相应的 `-older` 选项,但是你可以用 `! -newer` (即更旧)得到类似的结果,它们基本上一样。 ### 按类型查找文件 通过文件类型找到一个文件,你有很多选项——常规文件、目录、块和字符文件等等。以下是文件类型选项列表: ``` -b block (buffered) special -c character (unbuffered) special -d directory -p named pipe (FIFO) -f regular file -l symbolic link -s socket +b 块特殊文件(缓冲的) +c 字符特殊文件(无缓冲的) +d 目录 +p 命名管道(FIFO) +f 常规文件 +l 符号链接 +s 套接字 ``` -这里有一个寻找符号链接的例子: +这里有一个寻找符号链接的例子: ``` $ find . -type l -ls @@ -170,7 +167,7 @@ $ find . -type l -ls ### 限制查找的深度 -**-mindepth** 和 **-maxdepth** 选项控制在文件系统中搜索的深度(从当前位置或起始点开始)。 +`-mindepth` 和 `-maxdepth` 选项控制在文件系统中搜索的深度(从当前位置或起始点开始)。 ``` $ find -maxdepth 3 -name "*loop" @@ -181,7 +178,7 @@ $ find -maxdepth 3 -name "*loop" ### 查找空文件 -在这个命令中,我们寻找空文件,但不超过目录及其子目录。 +在这个命令中,我们寻找空文件,但不进入目录及其子目录。 ``` $ find . -maxdepth 2 -empty -type f -ls @@ -191,7 +188,7 @@ $ find . -maxdepth 2 -empty -type f -ls ### 按权限查找文件 -你可以使用 **-perm** 选项查找具有特定权限集的文件。在下面的示例中,我们只查找常规文件(**-type f**),以避免看到默认情况下被赋予这些权限的符号链接,即使它们引用的文件是受限的。 +你可以使用 `-perm` 选项查找具有特定权限集的文件。在下面的示例中,我们只查找常规文件(`-type f`),以避免看到符号链接,默认情况下符号链接被赋予了这种权限,即使它们所引用的文件是受限的。 ``` $ find -perm 777 -type f -ls @@ -201,26 +198,24 @@ find: ‘./.dbus’: Permission denied ### 使用查找来帮助你删除文件 -如果使用如下命令,你可以使用 find 命令定位并删除文件: +如果使用如下命令,你可以使用 `find` 命令定位并删除文件: ``` $ find . -name runme -exec rm {} \; ``` -{} 代表根据搜索条件找到的每个文件的名称。 +`{}` 代表根据搜索条件找到的每个文件的名称。 -一个非常有用的选项是将 **-exec** 替换为 **-ok**。当您这样做时,**find** 会在删除任何文件之前要求确认。 +一个非常有用的选项是将 `-exec` 替换为 `-ok`。当你这样做时,`find` 会在删除任何文件之前要求确认。 ``` $ find . -name runme -ok rm -rf {} \; < rm ... ./bin/runme > ? ``` -删除文件并不是 **-ok** 和 **-rm** 能为你做的唯一事情。例如,你可以复制、重命名或移动文件。 +删除文件并不是 `-ok` 和 `-exec` 能为你做的唯一事情。例如,你可以复制、重命名或移动文件。 -确实有很多选择可以有效地使用 find 命令,毫无疑问还有一些在本文中没有涉及到。我希望你已经找到一些新的,特别有帮助的。 - -加入[Facebook][3]和[LinkedIn][4]上的网络世界社区,评论最热门的话题。 +确实有很多选择可以有效地使用 `find` 命令,毫无疑问还有一些在本文中没有涉及到。我希望你已经找到一些新的,特别有帮助的。 -------------------------------------------------------------------------------- @@ -229,7 +224,7 @@ via: https://www.networkworld.com/article/3527420/how-to-find-what-you-re-lookin 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b555e5b49fb433f61b3cc767efbb078fe031e740 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 6 Mar 2020 11:39:57 +0800 Subject: [PATCH 231/260] PUB @heguangzhi https://linux.cn/article-11966-1.html --- ... How to find what you-re looking for on Linux with find.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200219 How to find what you-re looking for on Linux with find.md (99%) diff --git a/translated/tech/20200219 How to find what you-re looking for on Linux with find.md b/published/20200219 How to find what you-re looking for on Linux with find.md similarity index 99% rename from translated/tech/20200219 How to find what you-re looking for on Linux with find.md rename to published/20200219 How to find what you-re looking for on Linux with find.md index a6d515943e..4b2ca325ef 100644 --- a/translated/tech/20200219 How to find what you-re looking for on Linux with find.md +++ b/published/20200219 How to find what you-re looking for on Linux with find.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (heguangzhi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11966-1.html) [#]: subject: (How to find what you’re looking for on Linux with find) [#]: via: (https://www.networkworld.com/article/3527420/how-to-find-what-you-re-looking-for-on-linux-with-find.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 443afcf48aa2b8604169a5ef139574c5ca2518fc Mon Sep 17 00:00:00 2001 From: wetshoes <43409711+Fisherman110@users.noreply.github.com> Date: Fri, 6 Mar 2020 11:54:30 +0800 Subject: [PATCH 232/260] Fisherman110 translating (#17652) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update 20180306 Exploring free and open web fonts.md * Update 20180306 Exploring free and open web fonts.md 2020.3.4 * Update 20180306 Exploring free and open web fonts.md * Update 20180306 Exploring free and open web fonts.md * Update 20180306 Exploring free and open web fonts.md * Update 20180306 Exploring free and open web fonts.md first version * Update 20180306 Exploring free and open web fonts.md * Update 20180306 Exploring free and open web fonts.md * Update and rename sources/tech/20180306 Exploring free and open web fonts.md to translated/tech/ Exploring free and open web fonts.md 这是我第一次在LCTT翻译文章,可能会有比较多不足,请校对的朋友不吝指正! * Rename Exploring free and open web fonts.md to 20180306 Exploring free and open web fonts.md Co-authored-by: Xingyu.Wang --- ...80306 Exploring free and open web fonts.md | 72 ------------------ ...80306 Exploring free and open web fonts.md | 73 +++++++++++++++++++ 2 files changed, 73 insertions(+), 72 deletions(-) delete mode 100644 sources/tech/20180306 Exploring free and open web fonts.md create mode 100644 translated/tech/20180306 Exploring free and open web fonts.md diff --git a/sources/tech/20180306 Exploring free and open web fonts.md b/sources/tech/20180306 Exploring free and open web fonts.md deleted file mode 100644 index d01accfbce..0000000000 --- a/sources/tech/20180306 Exploring free and open web fonts.md +++ /dev/null @@ -1,72 +0,0 @@ -Fisherman110 translating - -Exploring free and open web fonts -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-docdish-yellow-typewriter-keys.png?itok=0sPgIdMG) - -There is no question that the face of the web has been transformed in recent years by open source fonts. Prior to 2010, the only typefaces you were likely to see in a web browser were the generic "web safe" [core fonts][1] from Microsoft. But that year saw the start of several revolutions: the introduction of the Web Open Font Format ([WOFF][2]), which offered an open standard for efficiently delivering font files over HTTP, and the launch of web-font services like [Google Fonts][3] and the [Open Font Library][4]—both of which offered web publishers access to a large collection of fonts, for free, available under open licenses. - -It is hard to overstate the positive impact of these events on web typography. But it can be all too easy to equate the successes of open web fonts with open source typography as a whole and conclude that the challenges are behind us, the puzzles solved. That is not the case, so if you care about type, the good news is there are a lot of opportunities to get involved in improvement. - -For starters, it's critical to understand that Google Fonts and Open Font Library offer a specialized service—delivering fonts in web pages—and they don't implement solutions for other use cases. That is not a shortcoming on the services' side; it simply means that we have to develop other solutions. - -There are a number of problems to solve. Probably the most obvious example is the awkwardness of installing fonts on a desktop Linux machine for use in other applications. You can download any of the web fonts offered by either service, but all you will get is a generic ZIP file with some TTF or OTF binaries inside and a plaintext license file. What happens next is up to you to guess. - -Most users learn quickly that the "right" step is to manually copy those font binaries into any one of a handful of special directories on their hard drive. But that just makes the files visible to the operating system; it doesn't offer much in the way of a user experience. Again, this is not a flaw with the web-font service; rather it's evidence of the point where the service stops and more work needs to be done on the other side. - -A big improvement from the user's perspective would be for the OS or the desktop environment to be smarter at this "just downloaded" stage. Not only would it install the font files to the right location but, more importantly, it could add important metadata that the user will want to access when selecting a font to use in a project. - -What this additional information consists of and how it is presented to the user is tied to another challenge: Managing a font collection on Linux is noticeably less pleasant than on other operating systems. Periodically, font manager applications appear (see [GTK+ Font Manager][5] for one of the most recent examples), but they rarely catch on. I've been thinking a lot about where I think they come up short; one core factor is they have limited themselves to displaying only the information embedded in the font binary: basic character-set coverage, weight/width/slope settings, embedded license and copyright statements, etc. - -But a lot of decisions go into the process of selecting a font for a job besides what's in this embedded data. Serious font users—like information designers, journal article authors, or book designers—make their font-selection decisions in the context of each document's requirements and needs. That includes license information, naturally, but it includes much more, like information about the designer and the foundry, stylistic trends, or details about how the font works in use. - -For example, if your document includes both English and Arabic text, you probably want a font where the Latin and Arabic glyphs were designed together by someone experienced with the two scripts. Otherwise, you'll waste a ton of time making tiny adjustments to the font sizes and line spacing trying to get the two languages to mix well. You may have learned from experience that certain designers or vendors are better at multi-script design than others. Or it might be relevant to your project that today's fashion magazines almost exclusively use "[Didone][6]"-style typefaces, a name that refers to super-high-contrast styles pioneered by [Firmin Didot][7] and [Giambattista Bodoni][8] around 200 years ago. It just happens to be the trend. - -But none of those terms (Didone, Didot, or Bodoni) are likely to show up in the binary's embedded data, nor is easy to tell whether the Latin and Arabic fit together or anything else about the typeface's back history. That information might appear in supplementary material like a type specimen or font documentation—if any exists. - -A specimen is a designed document (often a PDF) that shows the font in use and includes background information; it frequently serves a dual role as a marketing piece and a sample to look at when choosing a font. The considered design of a specimen showcases how the font functions in practice and in a manner that an automatically generated character table simply cannot. Documentation may include some other vital information, like how to activate the font's OpenType features, what mathematical or archaic forms it provides, or how it varies stylistically across supported languages. Making this sort of material available to the user in the font-management application would go a long way towards helping users find the fonts that fit their projects' needs. - -Of course, if we're going to consider a font manager that can handle documentation and specimens, we also have to take a hard look at what comes with the font packages provided by distributions. Linux users start with a few fonts automatically installed, and repository-provided packages are the only font source most users have besides downloading the generic ZIP archive. Those packages tend to be pretty bare-bones. Commercial fonts generally include specimens, documentation, and other support items, whereas open source fonts usually do not. - -There are some excellent examples of open fonts that do provide quality specimens and documentation (see [SIL Gentium][9] and [Bungee][10] for two distinctly different but valid approaches), but they rarely (if ever) make their way into the downstream packaging chain. We plainly can do better. - -There are some technical obstacles to offering a richer user experience for interacting with the fonts on your system. For one thing, the [AppStream][11] metadata standard defines a few [parameters][12] specific to font files, but so far includes nothing that would cover specimens, designer and foundry information, and other relevant details. For another, the [SPDX][13] (Software Package Data Exchange) format does not cover many of the software licenses (and license variants) used to distribute fonts. - -Finally, as any audiophile will tell you, a music player that does not let you edit and augment the ID3 tags in your MP3 collection is going to get frustrating quickly. You want to fix errors in the tags, you want to add things like notes and album art—essentially, you want to polish your library. You would want to do the same to keep your local font library in a pleasant-to-use state. - -But editing the embedded data in a font file has been taboo because fonts tend to get embedded and attached to other documents. If you monkey with the fields in a font binary, then redistribute it with your presentation slides, anyone who downloads those slides can end up with bad metadata through no fault of their own. So anyone making improvements to the font-management experience will have to figure out how to strategically wrangle repeated changes to the embedded and external font metadata. - -In addition to the technical angle, enriching the font-management experience is also a design challenge. As I said above, good specimens and well-written documentation exist for several open fonts. But there are many more packages missing both, and there are a lot of older font packages that are no longer being maintained. That probably means the only way that most open font packages are going to get specimens or documentation is for the community to create them. - -Perhaps that's a tall order. But the open source design community is bigger than it has ever been, and it is a highly motivated segment of the overall free and open source software movement. So who knows; maybe this time next year finding, downloading, and using fonts on a desktop Linux system will be an entirely different experience. - -One train of thought on the typography challenges of modern Linux users includes packaging, document design, and maybe even a few new software components for desktop environments. There are other trains to consider, too. The commonality is that where the web-font service ends, matters get more difficult. - -The best news, from my perspective, is that there are more people interested in this topic than ever before. For that, I think we have the higher profile that open fonts have received from big web-font services like Google Fonts and Open Font Library to thank. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/webfonts - -作者:[Nathan Willis][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/n8willis -[1]:https://en.wikipedia.org/wiki/Core_fonts_for_the_Web -[2]:https://en.wikipedia.org/wiki/Web_Open_Font_Format -[3]:https://fonts.google.com/ -[4]:https://fontlibrary.org/ -[5]:https://fontmanager.github.io/ -[6]:https://en.wikipedia.org/wiki/Didone_(typography) -[7]:https://en.wikipedia.org/wiki/Firmin_Didot -[8]:https://en.wikipedia.org/wiki/Giambattista_Bodoni -[9]:https://software.sil.org/gentium/ -[10]:https://djr.com/bungee/ -[11]:https://www.freedesktop.org/wiki/Distributions/AppStream/ -[12]:https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Fonts.html -[13]:https://spdx.org/ diff --git a/translated/tech/20180306 Exploring free and open web fonts.md b/translated/tech/20180306 Exploring free and open web fonts.md new file mode 100644 index 0000000000..605f7514e7 --- /dev/null +++ b/translated/tech/20180306 Exploring free and open web fonts.md @@ -0,0 +1,73 @@ + +探索免费而开放的网络字体 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-docdish-yellow-typewriter-keys.png?itok=0sPgIdMG) + +毫无疑问,近些年来互联网的面貌已经被开放免费的字体所改变。在早些的2010年,你在网络浏览器上几乎只能看到微软制作的最普通的“网络安全字体”[core fonts] +[1]。但这一年(2010)正好是好几轮技术革新开始的见证之年:Web开放字体格式的应用给网络高效传输字体文件提供了一个开放的标准,像[Google Fonts]和 +[Open Font Library]这样的网络字体服务使网络内容发布者在开放证书证书下可以免费使用海量的字体库。 + +要夸大这些网络排印领域大事件的积极影响是很难的。但是要将网络开放字体的成功与开源的网络排印划上等号作为一个整体却非常容易,而且得到的结论是挑战已经远离了我们,困难悉数被解决了。然而事实并非如此,如果你很关注网络字体,好消息是你会有非常多的机会参与到对这些字体的改进工作当中去。 + +对新手来说,必须要意识到谷歌字体和开源字体库为网页提供了特殊的”服务提供“(service—delivering)字体但是他们给其他使用情况制定字体解决方案。这不是服务方的短视,这是是意味这我们必须去建立其他的解决方案。 + +需要解决的问题还非常多。可能最明显的例子就是给linux桌面机器的其他软件安装字体使用所遇到的尴尬情况。你可以通过任何一种服务下载任何一种网络字体,但是你能得到的是一个最普通的压缩包文件,里面有一些TTF或OTF二进制文件和一个普通文本文件的证书。接下来会发生什么完完全全需要你去猜。 + +大部分用户很快学会了”正确“的步骤就是手动地复制这些字体二进制文件到他们硬件驱动里一大把的文件夹里的某个文件夹里。但是这样做只能使这个文件被操作系统检索到。它并不能为用户体验带来什么。再强调一遍,这不是网络字体服务的缺陷,然而它是对于关于服务到哪里停止和更多工作需要在其他方面做这个观点的证据。 + +在用户视角来说,一个巨大的提升可能就是直接在“下载“这个阶段系统或者桌面环境变得更智能。它(系统或桌面环境)不仅会把字体文件安装到正确的位置上,更重要的是,当用户选择在一个工程使用的字体时,它会自己添加用户所需要得到的重要的元数据。 + +附加信息的组成与它如何展示给用户连接着另一个挑战:在linux环境管理一个字体库明显不如任何其他操作系统愉快。字体管理软件总是时不时的出现一下(例如[GTK+ Font Manager][5] 这是最近的一个例子),但是他们(字体管理软件)很少能正确的时候出现。我一直在思考一大堆这些软件让人失望的方面。一个核心的原因是他们把自己限制只展示自己在二进制字体文件内嵌的信息:基本字符集的覆盖,粗细,宽度,和斜度的设定,内置的证书和版权说明等等。 + +但是在选择字体的过程中为了工作的选择(字体)都不能在内置数据中找到。正经的字体用户像信息设计者,杂志文章作者,或者书籍美工设计者,他们的字体选择是在每一份文件的需求上做出的。这些需求包含了证书信息,很自然的,它还包含了更多,像关于设计师和厂商的信息,潮流风格的趋势,或者字体在使用当中的细节。 + +举个例子,如果你的文档包含了英语和阿拉伯文,你多半想要一种某个很熟悉拉丁文和阿拉伯文设计师设计同时设计两种语言的字体。否则,你将浪费一大堆时间来微调字体大小和行间距来使两种语言良好地结合在一起。你可能从经验中学到,特定的设计师或服务商(字体)比其他人更善于多语言设计。或许和你职业相关的是今天的时尚杂志几乎无一例外的采用"[Didone][6]"风格的字体,"[Didone][6]"是指一种两百多年前最先被[Firmin Didot][7] 和 [Giambattista Bodoni][8]设计出来的反差超级大的字体风格。这种字体恰好就是现在的潮流。 + +但是这些字体(Didone, Didot, or Bodoni)中没有一种有可能会出现在内置的二进制文件中,你也不容易发现拉丁文和阿拉伯文是否相得益彰或其他关于字体的背后故事。这些信息有可能出现在补充的材料中,类似某种样本或字体文件中,如果这些东西存在的话。 + +字体样本是一份设计好的文档(一般是PDF),它展示了这种字体在使用的情况而且包括了背景信息。字体样本经常起到两重作用,作为市场样本和在挑选字体时的样本。一份样品精心的设计展示了字体在实际应用中的情况和一种自动生产字符表所不能形成的风格。字体样本文件也有可能包含了一些其他重要信息,比如怎样激活字体的开放特色,它提供了什么样的数学表达式和古体字,或者它怎么在跨支持的语言上风格多样。要使这些资源能够被字体管理软件上的用户使用还要走过帮助用户找到合适他们工程的字体的漫长之路。 + +当然,如果我们要去考虑一个字体管理软件能够解决文件和样本问题,我们也必须仔细观察各种发行版提供的字体包伴随着什么。linux的用户刚开始只有自动安装的那几种字体,并且提供仓库的包是大部分用户除了下载最普通的压缩包档案之外的唯一字体来源。这些资源包往往非常的“骨感”。商业字体总的来说都包含了样本,文档,还有其他的支持项目,然而开源字体往往没有(这些配套文件)。 + +也有一些很棒的开源字体提供了高质量的样本和文档的例子(例如 [SIL Gentium][9] 和 [Bungee][10] 是两种极度不一样但是有效的方案),但是他们几乎不涉足下端的整合包链条。我们肯定能做的(比他们)更好。 + +在和系统的字体交互方面提供更丰富的用户体验上面还有一些技术问题。比如说,[AppStream][11]的元数据标准定义了几项针对字体文件的参数,但是现在为止这些参数没有包含样本,设计师和厂商,和其他相关细节的任何信息。另外一个例子,[SPDX][13] (软件包信息交换)格式也没有包含很多软件证书(和证书参数),这些软件证书是用来分配指定字体的。 + +最后,就像任何一个唱片爱好者都会告诉你,一个不允许你编辑和完善你的mp3库的ID3信息(mp3头部的一个字节,记录歌手信息)的音乐播放器很快就会变得让人失望。你想要处理标志里的错误,你想要添加比如笔记和乐队,艺术家这样的基本信息,你想要提升你的音乐库。你可能想要做一样的事情来使你的本地字体仓库保持在一个方便使用的状态。 + +但是改动字体文件的内置数据已经被禁止了,因为字体往往是被内置或附加到其他文件里的。如果你拿字体二进制文件来胡闹的话,那么你需要重新为你的展示幻灯片分配字体,任何一个人下载这些幻灯片最终都会面对错误的元数据但他们自己并没有过失。所以任何一个要提升字体管理体验的人都要弄清楚如何来战略的讨论内置或外置的字体元数据里反反复复的变化。 + +除了技术角度之外,丰富字体管理的体验也是一个设计的挑战。就像我前面说的一样,有几种开放的字体也带了良好的样本和精心写好的证明文件。但是有更多的字体包两者都没有,还有大量的更老的字体包已经没有人维护了。这很可能意味着大部分开放字体包想要获得样本和证明文件的唯一办法就是让(字体)社区去为它们创造。 + +可能那(前面说的)是一个很高的要求。但是开源设计社区现在比它以前任何时候都要庞大,并且它(社区)是全面免费开源软件运动中的一个高度活跃的组成部分。所以谁知道呢。可能明年这个时候会发现,在linux桌面系统下载和使用字体会变成一种完全不同的体验。 + +在关于现代Linux用户的文字设计上的挑战的一连串思考中包含了打包文件,证明文件设计,甚至有可能需要在桌面环境加入不少新的软件成分。还有其他一连串的东西也需要考虑。共通性就是在网络字体服务不及的地方,事情就变得更加困难。 + +最好的消息是,从我的视角来看,就是现在比起以前有更多的人对这个议题感兴趣。我认为我们要感谢像谷歌字体和开放字体库这样的网络字体服务巨头让开放字体得到了更高的关注。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/3/webfonts + +作者:[Nathan Willis][a] +译者:https://github.com/Fisherman110 +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/n8willis +[1]:https://en.wikipedia.org/wiki/Core_fonts_for_the_Web +[2]:https://en.wikipedia.org/wiki/Web_Open_Font_Format +[3]:https://fonts.google.com/ +[4]:https://fontlibrary.org/ +[5]:https://fontmanager.github.io/ +[6]:https://en.wikipedia.org/wiki/Didone_(typography) +[7]:https://en.wikipedia.org/wiki/Firmin_Didot +[8]:https://en.wikipedia.org/wiki/Giambattista_Bodoni +[9]:https://software.sil.org/gentium/ +[10]:https://djr.com/bungee/ +[11]:https://www.freedesktop.org/wiki/Distributions/AppStream/ +[12]:https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Fonts.html +[13]:https://spdx.org/ From 53ffe89b6b1498bb3e1fccf63480544e0000d30d Mon Sep 17 00:00:00 2001 From: Hank Chow <280630620@qq.com> Date: Fri, 6 Mar 2020 12:16:45 +0800 Subject: [PATCH 233/260] hankchow translated --- ...ger That Doesn-t Need Your Phone Number.md | 143 ------------------ ...ger That Doesn-t Need Your Phone Number.md | 142 +++++++++++++++++ 2 files changed, 142 insertions(+), 143 deletions(-) delete mode 100644 sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md create mode 100644 translated/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md diff --git a/sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md b/sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md deleted file mode 100644 index 15529537a0..0000000000 --- a/sources/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md +++ /dev/null @@ -1,143 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Session: An Open Source Private Messenger That Doesn’t Need Your Phone Number) -[#]: via: (https://itsfoss.com/session-messenger/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Session: An Open Source Private Messenger That Doesn’t Need Your Phone Number -====== - -_**Brief: Our open source software highlight of the week is Session. It is a fork of another increasingly popular private messenger Signal. Session doesn’t even need your phone number to operate.**_ - -### Session: A private messenger in true sense - -![][1] - -Privacy concerned people are always in the search of an ultimate service that lets you communicate securely while respecting our privacy across multiple platforms. - -Recently, I came across an interesting open-source messaging app “[Session][2]” by [Loki Foundation][3], which is technically a fork of another [open source encrypted messenger Signal][4]. - -In this article, I’ll be sharing my experience with the Session app while highlighting the features it offers. - -Session is fairly new to the scene – I’ve mentioned some of the bugs that I encountered at the bottom of the article. - -### Features of Session Messenger - -I’ll highlight the key features of Session that will help you decide if it’s good enough for you to try. - -#### Session does not require a phone number - -![][5] - -For privacy-enthusiasts, registering the phone number with Signal or other such applications is a potential risk. - -But, with Session, you do not need a phone number, simply click on “**Create Account**” after you install it on your desktop or phone and it will simply generate a random (unique) **Session ID**. - -It’ll look something like this: **05652245af9a8bfee4f5a8138fd5c……..** - -So, you just have to share your Session ID with the contact you want to add. Or, you can also opt to get the **QR Code** after account creation which you can share with your friends to add you back. - -#### Session uses blockchain (and other crypto tech) - -![Session ID][6] - -For the users who’re aware of what a [blockchain][7] is – they’ve been waiting for real-world applications that an average user can utilize. Session is one such example that utilizes blockchain at its core and you don’t need to know it’s there. - -If you’re curious about how it works, you can take a look at their [official blog post][8] explaining it. - -#### Cross-Platform Support - -![][9] - -For something strictly privacy-focused, you’d also want it to be available across multiple platforms. - -Of course, primarily, I’d focus on the Linux and Android support but it also supports Windows/Mac/iOS. So, you can easily sync between multiple devices cross-platform. - -#### Includes Essential Privacy Options - -![][10] - -Undoubtedly, it offers some essential privacy-focused features that will help make the experience more secure. - -For starters, you have the following options: - - * **Message TTL**: This lets you control how long the message exists before the recipient sees the message. - * **Read Receipts**: Let others know that you’ve seen the message or if your message has been read. - - - -#### Session uses a decentralized network and protects your metadata - -Even though Session isn’t a peer-to-peer technology, it does not have a central server for the network. - -It takes a decentralized approach to how the messages are transmitted (or routed). If you’ve no idea what I’m talking about, you can follow Session’s official blog post to know the [difference between centralization and decentralization][11] and explore how it potentially works. - -And, this approach of network helps them to protect the metadata (the information associated with a message like IP address). - -#### Other Features - -Not just limited to the latest/greatest privacy-friendly features, but it also supports group chats, voice messages, and also allows you to send attachments. - -### Installing Session on Linux - -If you head to the [official download page][12], you will be able to download an .**AppImage** file. In case you have no clue how it works, you should take a look at our article on [how to use AppImage][13]. - -In either case, you can also head to their [GitHub releases page][14] and grab the **.deb** file. - -[Download Session][12] - -### My Experience On Using Session App - -I’ve managed to try it on multiple platforms. For the desktop, I utilized the .AppImage file on **Pop!_OS 19.10** to run Session. - -Overall, the user experience was impressive and had no UI glitches. - -It’s also easy to recover your account once you’ve backed up your secret code (which is known as **seed**) from the settings. - -![][15] - -But, I also noticed a couple of issues- which can be fixed/improved: - - * Delay in accepting a friend request - * The way of linking devices is not intuitive - * Sometimes when you reply from two separate devices (using the same ID), the receiver gets two different conversations. - - - -**Conclusion** - -Of course, nothing’s ever perfect. For now, I’m thinking of keeping it installed and considering Session’s features, it is definitely something a privacy-focused user should try. - -What do you think about it? Feel free to let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/session-messenger/ - -作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-app.jpg?ssl=1 -[2]: https://getsession.org/ -[3]: https://loki.foundation/ -[4]: https://itsfoss.com/signal-messaging-app/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-create.jpg?ssl=1 -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/session-application-id.jpg?ssl=1 -[7]: https://en.wikipedia.org/wiki/Blockchain -[8]: https://getsession.org/how-session-protects-your-anonymity-with-blockchain-and-crypto/ -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-cross-platform.jpg?ssl=1 -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-settings.jpg?fit=800%2C512&ssl=1 -[11]: https://getsession.org/centralisation-vs-decentralisation-in-private-messaging/ -[12]: https://getsession.org/download/ -[13]: https://itsfoss.com/use-appimage-linux/ -[14]: https://github.com/loki-project/session-desktop/releases -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-seed.jpg?ssl=1 diff --git a/translated/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md b/translated/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md new file mode 100644 index 0000000000..3cb2f915c4 --- /dev/null +++ b/translated/tech/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Session: An Open Source Private Messenger That Doesn’t Need Your Phone Number) +[#]: via: (https://itsfoss.com/session-messenger/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Session:一款不需要电话号码的开源通信应用 +====== + +Signal 作为一款私人通信应用,正在变得愈发流行。而我们下面要介绍开源应用 Session 则是 Signal 的一个复刻fork,它的一大亮点是并不需要提供手机号码即可以开始使用。 + +### Session:一款真正意义上的私人通信应用 + +![][1] + +对于私人通信服务来说,有没有既能保护通信安全性,又尊重用户跨平台隐私的集大成者呢?很多注重个人隐私的用户似乎都在寻找这个问题的答案。 + +最近,我留意到 [Loki Foundation][3] 开发的一款叫做 [Session][2] 的开源通信应用。从技术上来说,Session 是另一款[开源、加密的通信应用 Signal][4] 的一个复刻。 + +在本文中,我会讲述我自己使用 Session 的体验,以及 Session 的一些主要功能。 + +Session 在这个领域中算是一款比较新的应用了,因此我还会在文章的最后提到它的一些不足之处。 + +### Session 的一些主要功能 + +接下来我会重点介绍 Session 的主要功能,可以供你参考这款应用是否值得使用。 + +#### Session 的使用过程中不需要提供手机号码 + +![][5] + +在 Signal 或者其它类似的通信应用中,用户都需要提供手机号码才得以成功注册。注重隐私的用户们都认为这样的做法会潜藏着巨大的安全隐患。 + +而使用 Session 则简单得多。在 PC 或手机上安装应用之后,只需要点击“创建账号Create Account”,无须提供手机号码,它就会生成一个类似 **05652245af9a8bfee4f5a8138fd5c……..** 这样的随机且唯一的 Session ID。 + +此后,把 Session ID 分享给想要添加的联系人就可以了。Session 还支持二维码,其他人可以通过扫描二维码添加你的 Session ID 为好友。 + +#### Session 使用了区块链等加密技术 + +![Session ID][6] + +对[区块链][7]有所了解的用户都很期待区块链能为普罗大众做出什么有实际意义的应用,而 Session 可以算得上其中一个。尽管 Session 的核心是基于区块链的,但普通用户在使用时并不需要真正弄懂区块链。 + +如果你好奇它的工作原理,可以参考这篇[官方的博客文章][8],里面有相关的解释。 + +#### 跨平台支持 + +![][9] + +这样严格保护隐私的应用,是否能在不同平台上使用? + +答案是肯定的。首先,它支持 Linux 和 Android 平台,同时也支持 Windows/Mac/iOS 平台。因此跨平台、跨设备的消息同步是没有问题的。 + +#### 包含基本隐私选项 + +![][10] + +毫无疑问,基本的隐私功能是必须有的,这是作为一个以安全为卖点的应用所必备的体验。 + +最基本的选项包括: + + * **消息有效期**:你可以控制一条消息在接收者阅读前的保留时长 + * **已读回执**:消息发送者可以知晓你已经阅读该消息 + + + +#### Session 使用去中心化网络保护你的元数据 + +尽管 Session 不使用端对端peer-to-peer技术,但它也不适用中心化的服务器。 + +Session 采用了去中心化的架构实现消息的传输和路由。如果你不熟悉这方面的内容,可以关注 Session 的官方博客,尝试了解[中心化网络和去中心化网络的区别][11],以及它的实际工作原理。 + +同时,这样的网络架构还有助于保护诸如与 IP 地址相关的信息等元数据。 + +#### 其它功能 + +除了专注于隐私之外,Session 也支持群聊、语音消息、发送附件等通信应用的基本功能。 + +### 在 Linux 上安装 Session + +在[官方下载页面][12]中可以下载到对应的 .AppImage 文件。如果你不了解这个文件的使用方法,可以查阅我们的[相关文章][13]。 + +另外,你也可以在它的 [Github 发布页面][14] 获取到对应的 .deb 安装文件。 + +[下载 Session][12] + +### 我使用 Session 的体验 + +我在各种平台上都试用过 Session,其中在 PC 上我使用了 Pop!_OS 19.10 的 .AppImage 文件运行这个应用。 + +总的来说,使用的体验很不错,用户界面也没有出现问题。 + +在设置中备份了密码(也称为种子seed)后,可以很方便地恢复账号。 + +![][15] + +当然,我也发现了一些需要改进的地方: + + * 在接受好友请求时会出现延迟 + * 设备间连接的方式不太直观 + * 当你在不同的设备上使用同一个 Session ID 向同一个人回复消息时,对方会收到两个不同的对话 + + + +### 总结 + +当然,最完美的事物是不存在的。我也会一直使用 Session 并考虑它发展的方向,这是一个注重引得的用户应该做的事情。 + +欢迎在评论区发表你的看法。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/session-messenger/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-app.jpg?ssl=1 +[2]: https://getsession.org/ +[3]: https://loki.foundation/ +[4]: https://itsfoss.com/signal-messaging-app/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-create.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/session-application-id.jpg?ssl=1 +[7]: https://en.wikipedia.org/wiki/Blockchain +[8]: https://getsession.org/how-session-protects-your-anonymity-with-blockchain-and-crypto/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-cross-platform.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-settings.jpg?fit=800%2C512&ssl=1 +[11]: https://getsession.org/centralisation-vs-decentralisation-in-private-messaging/ +[12]: https://getsession.org/download/ +[13]: https://itsfoss.com/use-appimage-linux/ +[14]: https://github.com/loki-project/session-desktop/releases +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-seed.jpg?ssl=1 From 208d0be3e87a6c21988974aabc79c47c9ad4921c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E6=96=B0=E9=98=BF=E5=B2=A9?= <31788564+mengxinayan@users.noreply.github.com> Date: Fri, 6 Mar 2020 04:26:44 -0800 Subject: [PATCH 234/260] Translated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File name:20190731 How to structure a multi-file C program- Part 2.md Translator:mengxinayan - 萌新阿岩 --- ...tructure a multi-file C program- Part 2.md | 229 ------------------ ...tructure a multi-file C program- Part 2.md | 226 +++++++++++++++++ 2 files changed, 226 insertions(+), 229 deletions(-) delete mode 100644 sources/tech/20190731 How to structure a multi-file C program- Part 2.md create mode 100644 translated/tech/20190731 How to structure a multi-file C program- Part 2.md diff --git a/sources/tech/20190731 How to structure a multi-file C program- Part 2.md b/sources/tech/20190731 How to structure a multi-file C program- Part 2.md deleted file mode 100644 index 3f050b053b..0000000000 --- a/sources/tech/20190731 How to structure a multi-file C program- Part 2.md +++ /dev/null @@ -1,229 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (mengxinayan) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to structure a multi-file C program: Part 2) -[#]: via: (https://opensource.com/article/19/7/structure-multi-file-c-part-2) -[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) - -How to structure a multi-file C program: Part 2 -====== -Dive deeper into the structure of a C program composed of multiple files -in the second part of this article. -![4 manilla folders, yellow, green, purple, blue][1] - -In [Part 1][2], I laid out the structure for a multi-file C program called [MeowMeow][3] that implements a toy [codec][4]. I also talked about the Unix philosophy of program design, laying out a number of empty files to start with a good structure from the very beginning. Lastly, I touched on what a Makefile is and what it can do for you. This article picks up where the other one left off and now I'll get to the actual implementation of our silly (but instructional) MeowMeow codec. - -The structure of the **main.c** file for **meow**/**unmeow** should be familiar to anyone who's read my article "[How to write a good C main function][5]." It has the following general outline: - - -``` -/* main.c - MeowMeow, a stream encoder/decoder */ - -/* 00 system includes */ -/* 01 project includes */ -/* 02 externs */ -/* 03 defines */ -/* 04 typedefs */ -/* 05 globals (but don't)*/ -/* 06 ancillary function prototypes if any */ -    -int main(int argc, char *argv[]) -{ -  /* 07 variable declarations */ -  /* 08 check argv[0] to see how the program was invoked */ -  /* 09 process the command line options from the user */ -  /* 10 do the needful */ -} -    -/* 11 ancillary functions if any */ -``` - -### Including project header files - -The second section, **/* 01 project includes /***, reads like this from the source: - - -``` -/* main.c - MeowMeow, a stream encoder/decoder */ -... -/* 01 project includes */ -#include "main.h" -#include "mmecode.h" -#include "mmdecode.h" -``` - -The **#include** directive is a C preprocessor command that causes the contents of the named file to be "included" at this point in the file. If the programmer uses double-quotes around the name of the header file, the compiler will look for that file in the current directory. If the file is enclosed in <>, it will look for the file in a set of predefined directories. - -The file [**main.h**][6] contains the definitions and typedefs used in [**main.c**][7]. I like to collect these things here in case I want to use those definitions elsewhere in my program. - -The files [**mmencode.h**][8] and [**mmdecode.h**][9] are nearly identical, so I'll break down **mmencode.h**. - - -``` - /* mmencode.h - MeowMeow, a stream encoder/decoder */ -    - #ifndef _MMENCODE_H - #define _MMENCODE_H -    - #include <stdio.h> -    - int mm_encode(FILE *src, FILE *dst); -    - #endif /* _MMENCODE_H */ -``` - -The **#ifdef, #define, #endif** construction is collectively known as a "guard." This keeps the C compiler from including this file more than once per file. The compiler will complain if it finds multiple definitions/prototypes/declarations, so the guard is a _must-have_ for header files. - -Inside the guard, there are only two things: an **#include** directive and a function prototype declaration. I include **stdio.h** here to bring in the definition of **FILE** that is used in the function prototype. The function prototype can be included by other C files to establish that function in the file's namespace. You can think of each file as a separate _namespace_, which means variables and functions in one file are not usable by functions or variables in another file. - -Writing header files is complex, and it is tough to manage in larger projects. Use guards. - -### MeowMeow encoding, finally - -The meat and potatoes of this program—encoding and decoding bytes into/out of **MeowMeow** strings—is actually the easy part of this project. All of our activities until now have been putting the scaffolding in place to support calling this function: parsing the command line, determining which operation to use, and opening the files that we'll operate on. Here is the encoding loop: - - -``` - /* mmencode.c - MeowMeow, a stream encoder/decoder */ - ... -     while (![feof][10](src)) { -    -       if (![fgets][11](buf, sizeof(buf), src)) -         break; -              -       for(i=0; i<[strlen][12](buf); i++) { -         lo = (buf[i] & 0x000f); -         hi = (buf[i] & 0x00f0) >> 4; -         [fputs][13](tbl[hi], dst); -         [fputs][13](tbl[lo], dst); -       } -            } -``` - -In plain English, this loop reads in a chunk of the file while there are chunks left to read (**feof(3)** and **fgets(3)**). Then it splits each byte in the chunk into **hi** and **lo** nibbles. Remember, a nibble is half of a byte, or 4 bits. The real magic here is realizing that 4 bits can encode 16 values. I use **hi** and **lo** as indices into a 16-string lookup table, **tbl**, that contains the **MeowMeow** strings that encode each nibble. Those strings are written to the destination **FILE** stream using **fputs(3)**, then we move on to the next byte in the buffer. - -The table is initialized with a macro defined in [**table.h**][14] for no particular reason except to demonstrate including another project local header file, and I like initialization macros. We will go further into why a future article. - -### MeowMeow decoding - -Alright, I'll admit it took me a couple of runs at this before I got it working. The decode loop is similar: read a buffer full of **MeowMeow** strings and reverse the encoding from strings to bytes. - - -``` - /* mmdecode.c - MeowMeow, a stream decoder/decoder */ - ... - int mm_decode(FILE *src, FILE *dst) - { -   if (!src || !dst) { -     errno = EINVAL; -     return -1; -   } -   return stupid_decode(src, dst); - } -``` - -Not what you were expecting? - -Here, I'm exposing the function **stupid_decode()** via the externally visible **mm_decode()** function. When I say "externally," I mean outside this file. Since **stupid_decode()** isn't in the header file, it isn't available to be called in other files. - -Sometimes we do this when we want to publish a solid public interface, but we aren't quite done noodling around with functions to solve a problem. In my case, I've written an I/O-intensive function that reads 8 bytes at a time from the source stream to decode 1 byte to write to the destination stream. A better implementation would work on a buffer bigger than 8 bytes at a time. A _much_ better implementation would also buffer the output bytes to reduce the number of single-byte writes to the destination stream. - - -``` - /* mmdecode.c - MeowMeow, a stream decoder/decoder */ - ... - int stupid_decode(FILE *src, FILE *dst) - { -   char           buf[9]; -   decoded_byte_t byte; -   int            i; -      -   while (![feof][10](src)) { -     if (![fgets][11](buf, sizeof(buf), src)) -       break; -     byte.field.f0 = [isupper][15](buf[0]); -     byte.field.f1 = [isupper][15](buf[1]); -     byte.field.f2 = [isupper][15](buf[2]); -     byte.field.f3 = [isupper][15](buf[3]); -     byte.field.f4 = [isupper][15](buf[4]); -     byte.field.f5 = [isupper][15](buf[5]); -     byte.field.f6 = [isupper][15](buf[6]); -     byte.field.f7 = [isupper][15](buf[7]); -        -     [fputc][16](byte.value, dst); -   } -   return 0; - } -``` - -Instead of using the bit-shifting technique I used in the encoder, I elected to create a custom data structure called **decoded_byte_t**. - - -``` - /* mmdecode.c - MeowMeow, a stream decoder/decoder */ - ... - - typedef struct { -   unsigned char f7:1; -   unsigned char f6:1; -   unsigned char f5:1; -   unsigned char f4:1; -   unsigned char f3:1; -   unsigned char f2:1; -   unsigned char f1:1; -   unsigned char f0:1; - } fields_t; -    - typedef union { -   fields_t      field; -   unsigned char value; - } decoded_byte_t; -``` - -It's a little complex when viewed all at once, but hang tight. The **decoded_byte_t** is defined as a **union** of a **fields_t** and an **unsigned char**. The named members of a union can be thought of as aliases for the same region of memory. In this case, **value** and **field** refer to the same 8-bit region of memory. Setting **field.f0** to 1 would also set the least significant bit in **value**. - -While **unsigned char** shouldn't be a mystery, the **typedef** for **fields_t** might look a little unfamiliar. Modern C compilers allow programmers to specify "bit fields" in a **struct**. The field type needs to be an unsigned integral type, and the member identifier is followed by a colon and an integer that specifies the length of the bit field. - -This data structure makes it simple to access each bit in the byte by field name and then access the assembled value via the **value** field of the union. We depend on the compiler to generate the correct bit-shifting instructions to access the fields, which can save you a lot of heartburn when you are debugging. - -Lastly, **stupid_decode()** is _stupid_ because it only reads 8 bytes at a time from the source **FILE** stream. Usually, we try to minimize the number of reads and writes to improve performance and reduce our cost of system calls. Remember that reading or writing a bigger chunk less often is much better than reading/writing a lot of smaller chunks more frequently. - -### The wrap-up - -Writing a multi-file program in C requires a little more planning on behalf of the programmer than just a single **main.c**. But just a little effort up front can save a lot of time and headache when you refactor as you add functionality. - -To recap, I like to have a lot of files with a few short functions in them. I like to expose a small subset of the functions in those files via header files. I like to keep my constants in header files, both numeric and string constants. I _love_ Makefiles and use them instead of Bash scripts to automate all sorts of things. I like my **main()** function to handle command-line argument parsing and act as a scaffold for the primary functionality of the program. - -I know I've only touched the surface of what's going on in this simple program, and I'm excited to learn what things were helpful to you and which topics need better explanations. Share your thoughts in the comments to let me know. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/structure-multi-file-c-part-2 - -作者:[Erik O'Shaughnessy][a] -选题:[lujun9972][b] -译者:[萌新阿岩](https://github.com/mengxinayan) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jnyjny -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/file_system.jpg?itok=pzCrX1Kc (4 manilla folders, yellow, green, purple, blue) -[2]: https://opensource.com/article/19/7/how-structure-multi-file-c-program-part-1 -[3]: https://github.com/jnyjny/MeowMeow.git -[4]: https://en.wikipedia.org/wiki/Codec -[5]: https://opensource.com/article/19/5/how-write-good-c-main-function -[6]: https://github.com/JnyJny/meowmeow/blob/master/main.h -[7]: https://github.com/JnyJny/meowmeow/blob/master/main.c -[8]: https://github.com/JnyJny/meowmeow/blob/master/mmencode.h -[9]: https://github.com/JnyJny/meowmeow/blob/master/mmdecode.h -[10]: http://www.opengroup.org/onlinepubs/009695399/functions/feof.html -[11]: http://www.opengroup.org/onlinepubs/009695399/functions/fgets.html -[12]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html -[13]: http://www.opengroup.org/onlinepubs/009695399/functions/fputs.html -[14]: https://github.com/JnyJny/meowmeow/blob/master/table.h -[15]: http://www.opengroup.org/onlinepubs/009695399/functions/isupper.html -[16]: http://www.opengroup.org/onlinepubs/009695399/functions/fputc.html diff --git a/translated/tech/20190731 How to structure a multi-file C program- Part 2.md b/translated/tech/20190731 How to structure a multi-file C program- Part 2.md new file mode 100644 index 0000000000..85499e4362 --- /dev/null +++ b/translated/tech/20190731 How to structure a multi-file C program- Part 2.md @@ -0,0 +1,226 @@ +[#]: collector: (lujun9972) +[#]: translator: (mengxinayan) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to structure a multi-file C program: Part 2) +[#]: via: (https://opensource.com/article/19/7/structure-multi-file-c-part-2) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) + +如何组织构建多文件 C 语言程序(二) +====== +我将在本系列的第二篇中深入研究由多个文件组成的C程序的结构。 +![4 个 manilla 文件,黄色,绿色,紫色,蓝色][1] + +在 [(第一篇)][2] 中,我设计了一个名为 [MeowMeow][3] 的多文件 C 程序,该程序实现了一个玩具——[codec][4]。我提到了程序设计中的 Unix 哲学,即在一开始创建多个空文件,并建立一个好的结构。最后,我创建了一个 Makefile 文件夹并阐述了它的作用。在本文中将另一个方向展开:现在我将介绍简单但具有指导性的 MeowMeow 编/解码器的实现。 + +当读过我的 "[如何写一个好的 C 语言 main 函数][5]." 后,你便会知道 `main.c` 文件中 `meow` 和 `unmeow` 的结构,其主体结构如下: + +``` +/* main.c - MeowMeow 流编码器和解码器 */ + +/* 00 system includes */ +/* 01 project includes */ +/* 02 externs */ +/* 03 defines */ +/* 04 typedefs */ +/* 05 globals (but don't)*/ +/* 06 ancillary function prototypes if any */ +    +int main(int argc, char *argv[]) +{ +  /* 07 variable declarations */ +  /* 08 check argv[0] to see how the program was invoked */ +  /* 09 process the command line options from the user */ +  /* 10 do the needful */ +} +    +/* 11 ancillary functions if any */ +``` + +### 包含项目头文件 + +位于第二部分中的 `/* 01 project includes */` 的源代码如下: + + +``` +/* main.c - MeowMeow 流编码器和解码器 */ +... +/* 01 project includes */ +#include "main.h" +#include "mmecode.h" +#include "mmdecode.h" +``` + +`#include` 是 C 语言的预处理命令,它会将其后面的文件内容拷贝到当前文件中。如果程序员在头文件名称周围使用双引号,编译器将会在当前目录寻找该文件。如果文件被尖括号包围,编译器将在一组预定义的目录中查找该文件。 + +[main.h][6] 文件中包含了 [main.c][7] 文件中用到的定义和别名。我喜欢在头文件里尽可能多的声明,以便我想在我的程序的其他位置使用这些定义。 + +头文件 [mmencode.h][8] 和 [mmdecode.h][9] 几乎相同,因此我以 `mmencode.h` 为例来分析。 + + +``` + /* mmencode.h - MeowMeow 流编码器和解码器 */ +    + #ifndef _MMENCODE_H + #define _MMENCODE_H +    + #include <stdio.h> +    + int mm_encode(FILE *src, FILE *dst); +    + #endif /* _MMENCODE_H */ +``` + +`#ifdef`,`#define`,`#endif` 指令统称为 “防护” 指令。其可以防止 C 编译器在一个文件中多次包含同一文件。如果编译器在一个文件中发现多个定义/原型/声明,它将会产生警告。因此这些防护措施是必要的。 + +在防护内部,它只做两件事:`#include` 指令和函数原型声明。我将包含 `stdio.h` 头文件,以便于能在函数原型中使用 `FILE` 流。函数原型也可以被包含在其他 C 文件中,以便于在文件的命名空间中创建它。你可以将每个文件视为一个命名空间,其中的变量和函数不能被另一个文件中的函数或者变量使用。 + +编写头文件很复杂,并且在大型项目中很难管理它。不要忘记使用防护。 + +### MeowMeow 编码的实现 + +该程序的功能是按照字节进行 `MeowMeow` 字符串的编解码,事实上这是该项目中最简单的部分。截止目前我所做的工作便是支持允许在适当的位置调用此函数:解析命令行,确定要使用的操作,并打开将要操作的文件。下面的循环是编码的过程: + + +``` + /* mmencode.c - MeowMeow 流编码器 */ + ... +     while (![feof][10](src)) { +    +       if (![fgets][11](buf, sizeof(buf), src)) +         break; +              +       for(i=0; i<[strlen][12](buf); i++) { +         lo = (buf[i] & 0x000f); +         hi = (buf[i] & 0x00f0) >> 4; +         [fputs][13](tbl[hi], dst); +         [fputs][13](tbl[lo], dst); +       } +            } +``` + +简单的说,上面代码循环读取文件的一部分,剩下的内容通过 `feof(3)` 函数和 `fgets(3)` 函数读取。然后将读入的内容的每个字节分成 `hi` 和 `lo` 半个字节。半个字节是 4 个比特。这里的奥妙之处在于可以用 4 个比特来编码16个值。我将字符串 `hi` 和 `lo` 用作 16 字符串查找表 `tbl` 的索引,表中包含了对每半个字节编码后的 `MeowMeow` 字符串。这些字符串使用 `fputs(3)` 函数写入目标 `FILE` 流,然后移动到缓存区的下一个字节。 + +该表使用 [table.h][14] 中的宏定义进行初始化,在没有特殊原因(比如:要展示包含了另一个项目的本地头文件)时,我喜欢使用宏来进行初始化。我将在未来的文章中进一步探讨原因。 + +### MeowMeow 解码的实现 + +我承认在开始工作前花了一些时间。解码的循环与编码类似:读取 `MeowMeow` 字符串到缓冲区,将编码从字符串转换为字节 + + +``` + /* mmdecode.c - MeowMeow 流解码器 */ + ... + int mm_decode(FILE *src, FILE *dst) + { +   if (!src || !dst) { +     errno = EINVAL; +     return -1; +   } +   return stupid_decode(src, dst); + } +``` + +这不是所期望的吗? + +在这里,我通过外部公开的 `mm_decode()` 函数公开了 `stupid_decode()` 函数细节。我上面所说的“外部”是指在这个文件之外。因为 `stupid_decode()` 函数不在头文件中,因此无法在其他文件中调用它。 + +当我们想发布一个可靠的公共接口时,有时候会这样做,但是我们还没有完全使用函数解决问题。在本例中,我编写了一个 I/O 密集型函数,该函数每次从源中读取 8 个字节,然后解码获得 1 个字节写入目标流中。较好的实现是一次处理多于 8 个字节的缓冲区。更好的实现还可以通过缓冲区输出字节,进而减少目标流中单字节的写入次数。 + + +``` + /* mmdecode.c - MeowMeow 流解码器 */ + ... + int stupid_decode(FILE *src, FILE *dst) + { +   char           buf[9]; +   decoded_byte_t byte; +   int            i; +      +   while (![feof][10](src)) { +     if (![fgets][11](buf, sizeof(buf), src)) +       break; +     byte.field.f0 = [isupper][15](buf[0]); +     byte.field.f1 = [isupper][15](buf[1]); +     byte.field.f2 = [isupper][15](buf[2]); +     byte.field.f3 = [isupper][15](buf[3]); +     byte.field.f4 = [isupper][15](buf[4]); +     byte.field.f5 = [isupper][15](buf[5]); +     byte.field.f6 = [isupper][15](buf[6]); +     byte.field.f7 = [isupper][15](buf[7]); +        +     [fputc][16](byte.value, dst); +   } +   return 0; + } +``` + +我并没有使用编码器中使用的位移方法,而是创建了一个名为 `decoded_byte_t` 的自定义数据结构。 + +``` + /* mmdecode.c - MeowMeow 流解码器 */ + ... + + typedef struct { +   unsigned char f7:1; +   unsigned char f6:1; +   unsigned char f5:1; +   unsigned char f4:1; +   unsigned char f3:1; +   unsigned char f2:1; +   unsigned char f1:1; +   unsigned char f0:1; + } fields_t; +    + typedef union { +   fields_t      field; +   unsigned char value; + } decoded_byte_t; +``` + +初次看到代码时可能会感到有点儿复杂,但不要放弃。`decoded_byte_t` 被定义为 `fields_t` 和 `unsigned char` 的 **联合体** 。可以将联合中的命名成员看作同一内存区域的别名。在这种情况下,`value` 和 `field` 指向相同的 8 比特内存区域。将 `field.f0` 设置为 1 也将设置 `value` 中的最低有效位。 + +虽然 `unsigned char` 并不神秘,但是对 `fields_t` 的 别名(`typedef`) 也许看起来有些陌生。现代 C 编译器允许程序员在结构体中指定单个 bit 的值。`field` 成员是一个无符号整数类型,可以在成员标识符后紧跟一个冒号和一个整数,该整数指定了比特字段的长度。 + +这种数据结构使得按 `field` 名称访问每个比特变得简单。我们依赖编译器生成正确的移位指令来访问 `field`,这可以在调试时为你节省不少时间。 + +最后,因为`stupid_decode()` 函数一次仅从源 `FILE` 流中读取 8 个字节,所以它效率并不高。通常我们尝试最小化读写次数,以提高性能和降低调用系统调用的开销。请记住:少次数的读取/写入大的块比多次数的读取/写入小的块好得多。 + +### 总结 + +用 C 语言编写一个多文件程序需要程序员做更多计划,而不仅仅是一个 `main.c`。但是当你添加功能或者重构时,只需要多花费一点儿努力便可以节省大量时间以及避免让你头痛的问题。 + +回顾一下,我更喜欢这样做:多个文件,每个文件仅有简单功能;通过头文件公开那些文件中的小部分功能;把数字常量和字符串常量保存在头文件中;使用 `Makefile` 而不是 Bash 脚本来自动化处理事务;使用 `main()` 函数来处理和解析命令行参数并作为程序主要功能的框架。 + +我知道我只是涉及了这个简单程序中发生的事情,并且我很高兴知道哪些事情对您有所帮助以及哪些主题需要详细的解释。在评论中分享您的想法,让我知道。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/structure-multi-file-c-part-2 + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[萌新阿岩](https://github.com/mengxinayan) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/file_system.jpg?itok=pzCrX1Kc (4 manilla folders, yellow, green, purple, blue) +[2]: https://opensource.com/article/19/7/how-structure-multi-file-c-program-part-1 +[3]: https://github.com/jnyjny/MeowMeow.git +[4]: https://en.wikipedia.org/wiki/Codec +[5]: https://opensource.com/article/19/5/how-write-good-c-main-function +[6]: https://github.com/JnyJny/meowmeow/blob/master/main.h +[7]: https://github.com/JnyJny/meowmeow/blob/master/main.c +[8]: https://github.com/JnyJny/meowmeow/blob/master/mmencode.h +[9]: https://github.com/JnyJny/meowmeow/blob/master/mmdecode.h +[10]: http://www.opengroup.org/onlinepubs/009695399/functions/feof.html +[11]: http://www.opengroup.org/onlinepubs/009695399/functions/fgets.html +[12]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html +[13]: http://www.opengroup.org/onlinepubs/009695399/functions/fputs.html +[14]: https://github.com/JnyJny/meowmeow/blob/master/table.h +[15]: http://www.opengroup.org/onlinepubs/009695399/functions/isupper.html +[16]: http://www.opengroup.org/onlinepubs/009695399/functions/fputc.html From f058cb8df986784640b6b97c19bb9495fe38f1e9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 6 Mar 2020 23:24:47 +0800 Subject: [PATCH 235/260] PRF @geekpi --- ...4 PHP Development on Fedora with Eclipse.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20200214 PHP Development on Fedora with Eclipse.md b/translated/tech/20200214 PHP Development on Fedora with Eclipse.md index a9e0e48a56..ad2bc7927e 100644 --- a/translated/tech/20200214 PHP Development on Fedora with Eclipse.md +++ b/translated/tech/20200214 PHP Development on Fedora with Eclipse.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (PHP Development on Fedora with Eclipse) @@ -12,7 +12,7 @@ ![][1] -[Eclipse][2] 是由 Eclipse 基金会开发的功能全面的免费开源 IDE。自 2001 年以来一直存在。你可以在此 IDE 中编写从 C/C++ 和 Java 到 PHP、Python、HTML、JavaScript、Kotlin 等。 +[Eclipse][2] 是由 Eclipse 基金会开发的功能全面的自由开源 IDE。它诞生于 2001 年。你可以在此 IDE 中编写各种程序,从 C/C++ 和 Java 到 PHP,乃至于 Python、HTML、JavaScript、Kotlin 等等。 ### 安装 @@ -36,15 +36,15 @@ sudo dnf install eclipse-pdt ### 示例项目 -现在已经安装了 IDE,让我们创建一个简单的 PHP 项目。进入 _File →New → Project_。在出现的对话框中,选择 _PHP project_。输入项目的名称。你可能还需要更改其他一些选项,例如更改项目的默认位置,启用 JavaScript 以及更改 PHP 版本。请看以下截图。 +现在已经安装了 IDE,让我们创建一个简单的 PHP 项目。进入 “File →New → Project”。在出现的对话框中,选择 “PHP project”。输入项目的名称。你可能还需要更改其他一些选项,例如更改项目的默认位置,启用 JavaScript 以及更改 PHP 版本。请看以下截图。 ![Create A New PHP Project in Eclipse][3] -你可以单击 _Finish_ 按钮创建项目,或按 _Next_ 配置其他选项,例如添加包含和构建路径。在大多数情况下,你无需更改这些设置。 +你可以单击 “Finish” 按钮创建项目,或按 “Next” 配置其他选项,例如添加包含和构建路径。在大多数情况下,你无需更改这些设置。 -创建项目后,右键单击项目文件夹,然后选择 _New→PHP File_ 将新的 PHP 文件添加到项目。在本教程中,我将其命名为 _index.php_,这是每个 PHP 项目中公认的默认文件。 +创建项目后,右键单击项目文件夹,然后选择 “New→PHP File” 将新的 PHP 文件添加到项目。在本教程中,我将其命名为 `index.php`,这是每个 PHP 项目中公认的默认文件。 -![][4] +![add a new PHP file][4] 接着在新文件中添加代码。 @@ -52,9 +52,9 @@ sudo dnf install eclipse-pdt 在上面的例子中,我在同一页面上使用了 CSS、JavaScript 和 PHP 标记,主要是为了展示 IDE 能够支持所有这些标记。 -页面完成后,你可以将文件移至 Web 服务器文档根目录或在项目目录中创建一个开发 PHP 服务器来查看输出。 +页面完成后,你可以将文件移至 Web 服务器文档根目录或在项目目录中创建一个 PHP 开发服务器来查看输出。 -借助 Eclipse 中的内置终端,我们可以直接在 IDE 中启动 PHP 开发服务器。只需单击工具栏上的终端图标(![Terminal Icon][6]),然后单击 _OK_。在新终端中,进入项目目录,然后运行以下命令: +借助 Eclipse 中的内置终端,我们可以直接在 IDE 中启动 PHP 开发服务器。只需单击工具栏上的终端图标(![Terminal Icon][6]),然后单击 “OK”。在新终端中,进入项目目录,然后运行以下命令: ``` php -S localhost:8080 -t . index.php @@ -73,7 +73,7 @@ via: https://fedoramagazine.org/php-development-on-fedora-with-eclipse/ 作者:[Mehdi Haghgoo][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 e914684a46546d8c4e549cc3e65fcba9a2e36fa0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 6 Mar 2020 23:25:25 +0800 Subject: [PATCH 236/260] PUB @geekpi https://linux.cn/article-11967-1.html --- .../20200214 PHP Development on Fedora with Eclipse.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200214 PHP Development on Fedora with Eclipse.md (98%) diff --git a/translated/tech/20200214 PHP Development on Fedora with Eclipse.md b/published/20200214 PHP Development on Fedora with Eclipse.md similarity index 98% rename from translated/tech/20200214 PHP Development on Fedora with Eclipse.md rename to published/20200214 PHP Development on Fedora with Eclipse.md index ad2bc7927e..d373722c0e 100644 --- a/translated/tech/20200214 PHP Development on Fedora with Eclipse.md +++ b/published/20200214 PHP Development on Fedora with Eclipse.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11967-1.html) [#]: subject: (PHP Development on Fedora with Eclipse) [#]: via: (https://fedoramagazine.org/php-development-on-fedora-with-eclipse/) [#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) From f8531192dda8f9e5489b9c33c1765840f6439bc9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 6 Mar 2020 23:49:38 +0800 Subject: [PATCH 237/260] PRF @wxy --- ... fast, private open source mesh network.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20200214 How to set up your own fast, private open source mesh network.md b/translated/tech/20200214 How to set up your own fast, private open source mesh network.md index 1ce5cdae9d..f23480ebc6 100644 --- a/translated/tech/20200214 How to set up your own fast, private open source mesh network.md +++ b/translated/tech/20200214 How to set up your own fast, private open source mesh network.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to set up your own fast, private open source mesh network) [#]: via: (https://opensource.com/article/20/2/mesh-network-freemesh) [#]: author: (Spencer Thomason https://opensource.com/users/spencerthomason) -如何建立自己的快速、私有的开源网状网络 +如何建立自己的快速、私有的开源网状网络(mesh) ====== > 只需要不到 10 分钟的安装时间,就可以用 FreeMesh 搭建一个经济实惠、性能卓越、尊重隐私的网格系统。 -![people on top of a connected globe][1] +![](https://img.linux.net.cn/data/attachment/album/202003/06/234848jaga52a0wx05w0f0.jpg) -[FreeMesh][2] 系统有望为大众带来完全开源的网格网络mesh network。我最近有机会进行了测试;它安装迅速,性能非常好 —— 特别是相对它的价格而言。 +[FreeMesh][2] 系统有望为大众带来完全开源的网状网络mesh network(LCTT 译注:也称之为“多跳网络”)。我最近有机会对它进行了测试;它安装迅速,性能非常好 —— 特别是相对它的价格而言。 ### 为什么要网格化和开源? -使用开源的原因很简单:隐私。有了 FreeMesh,你的数据就是你自己的。它不会跟踪或收集数据。不相信吗?毕竟,你可以轻松检查 —— 它是开源的!而其它大型高科技企业集团提供的一些流行的网格解决方案,你是否相信它们会保护你的数据? +使用开源的原因很简单:隐私。有了 FreeMesh,你的数据就是你自己的。它不会跟踪或收集数据。不相信吗?毕竟,你可以轻松检查 —— 它是开源的!而其它大型高科技企业集团提供的一些流行的网状网络解决方案,你是否相信它们会保护你的数据? -另一个重要因素:更新。FreeMesh 表示,它将致力于定期发布安全性和性能更新。从现在起到 10 年后呢?使用开放源代码解决方案,你可以根据需要自由地更新产品。 +另一个重要因素:更新。FreeMesh 表示,它将致力于定期发布安全性和性能更新。从现在起到 10 年后呢?使用开源解决方案,你可以根据需要自由地更新产品。 -那么为什么要用网格呢?在网状网络中,多个无线路由器一起工作以广播单个超大型的无线网络。网状网络中的每个路由器都可与其他路由器智能地通信,以便为你的数据提供最佳的“路径”。FreeMesh 网站上的以下图片突出显示了使用单个无线路由器和网状网络之间的区别。 红色网络表示单个无线路由器,绿色网络是网状网络。 +那么为什么要用网状网络呢?在网状网络中,多个无线路由器一起工作以广播单个超大型的无线网络。网状网络中的每个路由器都可与其他路由器智能地通信,以便为你的数据提供最佳的“路径”。FreeMesh 网站上的以下图片突出显示了使用单个无线路由器和网状网络之间的区别。红色网络表示单个无线路由器,绿色网络是网状网络。 ![单路由器网络] [3] @@ -52,7 +52,7 @@ FreeMesh 路由器的一些规格非常好: ![FreeMesh 设置步骤 1][8] -2、等待约 30 至 60 秒。设置完成后,节点将闪烁其 LED。 +2、等待约 30 至 60 秒。设置完成后,节点的 LED 将会闪烁。 ![FreeMesh 设置步骤 2][9] @@ -74,7 +74,7 @@ FreeMesh 是开箱即用的,它由 OpenWRT 和 LuCI 组合而成。它具有 设置完 FreeMesh 系统后,我将节点移动到了房屋周围的各个地方。我使用 [iPerf][13] 测试带宽,它达到了约 150Mbps。WiFi 可能会受到许多环境变量的影响,因此你的结果可能会有所不同。节点与主路由器之间的距离在带宽中也有很大的影响。 -但是,网状网络的真正优势不是高峰速度,而是整个空间的平均速度要好得多。即使在我家很远的地方,我仍然能够流媒体播放视频并正常工作。我甚至可以在后院工作。在出门之前,我只是将一个节点重新放在窗口前面而已。 +但是,网状网络的真正优势不是高峰速度,而是整个空间的平均速度要好得多。即使在我家很远的地方,我仍然能够用流媒体播放视频并正常工作。我甚至可以在后院工作。在出门之前,我只是将一个节点重新放在窗口前面而已。 ### 结论 @@ -91,7 +91,7 @@ via: https://opensource.com/article/20/2/mesh-network-freemesh 作者:[Spencer Thomason][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 ef01bb94f3a2382c6bcdcd2bf6505dc786a878ee Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 6 Mar 2020 23:52:50 +0800 Subject: [PATCH 238/260] PUB @wxy https://linux.cn/article-11968-1.html --- ... set up your own fast, private open source mesh network.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200214 How to set up your own fast, private open source mesh network.md (98%) diff --git a/translated/tech/20200214 How to set up your own fast, private open source mesh network.md b/published/20200214 How to set up your own fast, private open source mesh network.md similarity index 98% rename from translated/tech/20200214 How to set up your own fast, private open source mesh network.md rename to published/20200214 How to set up your own fast, private open source mesh network.md index f23480ebc6..dbf4bfc481 100644 --- a/translated/tech/20200214 How to set up your own fast, private open source mesh network.md +++ b/published/20200214 How to set up your own fast, private open source mesh network.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11968-1.html) [#]: subject: (How to set up your own fast, private open source mesh network) [#]: via: (https://opensource.com/article/20/2/mesh-network-freemesh) [#]: author: (Spencer Thomason https://opensource.com/users/spencerthomason) From 59288fa92b615ccf78e699aa0e95b1f32a90df88 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 7 Mar 2020 01:01:58 +0800 Subject: [PATCH 239/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200306=20How=20?= =?UTF-8?q?I=20learned=20about=20burnout=20the=20hard=20way?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200306 How I learned about burnout the hard way.md --- ...ow I learned about burnout the hard way.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 sources/tech/20200306 How I learned about burnout the hard way.md diff --git a/sources/tech/20200306 How I learned about burnout the hard way.md b/sources/tech/20200306 How I learned about burnout the hard way.md new file mode 100644 index 0000000000..ce9af6fb52 --- /dev/null +++ b/sources/tech/20200306 How I learned about burnout the hard way.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I learned about burnout the hard way) +[#]: via: (https://opensource.com/article/20/3/burnout) +[#]: author: (Jason Hibbets https://opensource.com/users/jhibbets) + +How I learned about burnout the hard way +====== +Burnout can happen to anyone. Here are the 3 things I wish I knew before +I burned out. +![Light bulb][1] + +In early 2017, I was mentally in a bad spot. It was the perfect storm of stress, the kind that no one asks for, but you deal with the hand you're dealt. Work was piling up to a point where I couldn't process all the things that were expected of me. I was training for spring half-marathons, which should have been stress relief, but I was putting too much pressure on myself to perform at a high level. And then on top of the everyday family obligations, a surgery in our household turned us into a one-car family and seriously added to the mounting pressure on me to provide and take care of the family. + +Then I broke. + +It wasn't one thing. It was the culmination of things. And it hit me from the blind side, unexpected. I never thought I would be a victim of burnout. I was aware of it and thoughtful about the community I was managing. But "not me," I thought to myself, "I've got this under control." I remember thinking that something was wrong; something was off. But I couldn't quite put my finger on the source. + +I distinctly remember the day where I cried at work, crumbling under the pressure that I was putting on myself. I consider myself a high performer in the office environment. I push myself to exceed the goals that my team co-creates because I want that success. I want the feeling that comes with it. But this experience was different. This wasn't a healthy win for my team or me. I felt like I let everyone down, including myself. + +I was attending South by Southwest in Austin, Texas, where I was [presenting my first Ignite Talk][2] on applying open source principles to government—a talk that was well received by the audience. I remember practicing, and practicing, and practicing more the day before and the morning of my talk. I got that high that comes after delivering a great talk. I had a book signing at the City of Raleigh's Economic Development booth during the event, which was another emotional boost. Life was good. Upon reflection, that's when I started noticing signs of my burnout. + +I didn't have much of an appetite. I was tired all the time. I was sleeping in, and not because of jet lag. I was exercising but wasn't getting the endorphins I was used to. And I wasn't motivated to do the work that I normally love to do. I was very blah and meh about getting work done or hanging out with people I love. These are all signs of depression and burnout. + +After the trip, I scheduled my annual physical and talked to my doctor about my situation, who recommended I see a psychologist. I sat on the couch and talked things out. I was diagnosed with severe anxiety, which was enough for me to know that I didn't want to know what true depression felt like. + +I learned my lesson the hard way. I'd like to share my experience so that you can recognize the signs and avoid going down this path. And before we move on, I must say that it's perfectly fine to ask for help. Ask a trusted co-worker or friend for help or guidance. We're human, and we need to help each other through the ups and the downs. + +### Three things to know about burnout + +Work burnout is a form of depression where you are not motivated to do the things that are expected of you at your job. It's not the occasional slacking off or spring fever because the weather is nice. It's a buildup of emotional stress where you don't want to do what is asked of you at work. There are numerous factors that can lead to burnout. + +#### Know the signs of burnout + +Lesson number one about burnout is to know the signs. I mentioned some of the things I was experiencing, but there are many others. I remember one thing that was extremely abnormal for me (because I'm so social) is that I started to separate myself from my usual team activities and people. + + * Hey Jason, want to grab lunch with us? Nope, I'm too busy. + * Hey Jason, Matt's in town, want to join us for happy hour? No. I've got work to do. + + + +This is totally unlike me. I would normally have said yes to both those opportunities. According to the [Mayo Clinic][3], here are a few things to ask yourself if you think you are experiencing burnout: + + * Do you drag yourself to work? + * Do you have trouble getting started with work? + * Are you cynical or critical at work? + * Have you become irritable or impatient with co-workers or customers? + * Do you lack the energy to be productive? + * Do you find it hard to concentrate? + * Do you lack satisfaction from your achievements? + * Do you feel disillusioned about your work? + * Are you using food, drugs, or alcohol to feel better or to simply not feel? + * Have your sleep habits changed? + * Are you troubled by unexplained headaches, stomach or bowel problems, or other physical complaints? + + + +You can check your own burnout risk at [BurnoutIndex.org][4], an anonymous online questionnaire created in response to the [high level of burnout][5] in the tech industry. + +#### Prevent burnout + +The second lesson is to identify ways [to prevent burnout][6]. First, take time away from your job and plan time to unplug and unwind. This means planning vacations, staycations, or other time away from work. It's sometimes hard to unplug like this with the pressures and obligations we put on ourselves. + +There are three different levels of paid time off (PTO): + + 1. **Best way to unplug:** I'm totally cut-off, not logging in, not checking email. + 2. **Decent way to unplug:** I'm kind of checking in, but not as responsive as normal. + 3. **Meh way to unplug:** I'm available if you need me, I'll monitor email, but I'm away from normal office life. + + + +Your situation will dictate which of these levels of time off will work for you. In my experience, you need at least two total check-outs a year. I typically have a blend of all three throughout the year, but since 2017, I have taken at least three week-long vacations each year to completely escape. It's working so far! + +#### Manage stress + +The third and final lesson is to manage stress effectively. My first go-to for stress management is exercise. I'm addicted to it. I work out pretty much every single day. And I like to mix it up: Cardio, weight lifting, swimming, running, cycling, surfing, and high-intensity interval training (HIIT) are staples in my exercise routine. I used to focus solely on running four to six half marathons a year, but I recently switched to triathlons. The multidisciplinary aspect of the activity has brought more joy and different challenges to my life. + +Another way to reduce stress is to manage your time better. Time is our most precious resource. You've got to choose how you want to spend your time. Family, work, self, social? It's up to you. Find ways to work more efficiently, more effectively, and make sure that you put yourself first. It may sound selfish, but as I've learned from the airplane preflight safety videos, "you need to put your mask on first before helping others." + +### Conclusion + +Burnout can lead to fatigue, excessive stress, sadness, anger, irritability, insomnia, alcohol or substance misuse, heart disease, and other medical conditions—all things that are not good for humans or for your team at work. I hope you can use these tips to put yourself first, reduce stress, and prevent burnout. + +* * * + +_Jason Hibbets will present "[10 things I wish I knew before experiencing burnout][7]" at [SCaLE 18x][8], March 5–8, 2020, in Pasadena, Calif. This article is a preview for the talk and a way to share a bit of his experience._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/burnout + +作者:[Jason Hibbets][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/jhibbets +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bulb-light-energy-power-idea.png?itok=zTEEmTZB (Light bulb) +[2]: https://schedule.sxsw.com/2017/events/PP96070 +[3]: https://www.mayoclinic.org/healthy-lifestyle/adult-health/in-depth/burnout/art-20046642 +[4]: https://burnoutindex.org/ +[5]: https://opensource.com/article/19/11/burnout-open-source-communities +[6]: https://www.redhat.com/sysadmin/tips-avoiding-burnout +[7]: https://www.socallinuxexpo.org/scale/18x/presentations/10-things-i-wish-i-knew-experiencing-burnout +[8]: https://www.socallinuxexpo.org/scale/18x/ From d9b1ce8a6ba5484470f7bbb8110a55e620497476 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 7 Mar 2020 01:06:10 +0800 Subject: [PATCH 240/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200306=20Commun?= =?UTF-8?q?icating=20with=20other=20users=20on=20the=20Linux=20command=20l?= =?UTF-8?q?ine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200306 Communicating with other users on the Linux command line.md --- ...h other users on the Linux command line.md | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 sources/tech/20200306 Communicating with other users on the Linux command line.md diff --git a/sources/tech/20200306 Communicating with other users on the Linux command line.md b/sources/tech/20200306 Communicating with other users on the Linux command line.md new file mode 100644 index 0000000000..838c022976 --- /dev/null +++ b/sources/tech/20200306 Communicating with other users on the Linux command line.md @@ -0,0 +1,148 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Communicating with other users on the Linux command line) +[#]: via: (https://www.networkworld.com/article/3530343/communicating-with-other-users-on-the-linux-command-line.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Communicating with other users on the Linux command line +====== + +Thinkstock / Linux + +Sending messages to other users on the Linux command line can be very easy, but there are a number of commands that you might want to consider. In this post, we’ll look at four commands and see how each of them works. + +### wall + +The **wall** command (as in "write all") allows you to send a message to all users who are currently logged into the system. This implies that the system is likely a server and that users are working on the command line. While the wall command is generally used by sysadmins to send out notices to users to let send out information (e.g., that the server is going down for maintenance), it can be used by any user. + +A sysadmin might send out a message like this: + +``` +$ wall The system will be going down in 15 minutes to address a serious problem +``` + +Everyone logged into the system will see something like this: + +``` +Broadcast message from admin@dragonfly (pts/0) (Thu Mar 5 08:56:42 2020): + +The system is going down in 15 minutes to address a serious problem +``` + +If you want to use single quote marks in your message, enclose the message in double quote marks like this: + +``` +$ wall “Don’t forget to save your work before logging off” +``` + +The outside quote marks will not show up in the transmitted message, but, without them, the command sits and waits for a closing single quote. + +### mesg + +If, for some reason, you don’t want to accept messages from another user, you can stop them from arriving with the **mesg** command. This command can be used with a “n” argument to refuse mail from the user or a “y” argument to allow the messages to arrive. + +[][1] + +``` +$ mesg n doug +$ mesg y doug +``` + +The blocked user will not be notified that their messages have been blocked. You can also block or allow all messages with a **mesg** command like one of these: + +``` +$ mesg y +$ mesg n +``` + +### write + +Another command for sending text without reverting to email is **write**. This command can be used to communicate with a specific user. + +``` +$ write nemo +Are you still at your desk? +I need to talk with you right away. +^C +``` + +Enter your text and use **^C** to exit when you’re done. The command allows you to send text, but doesn’t start a two-way conversation. It just sends the text. If the user is logged in on more than one terminal, you can specify which terminal you want to send the message to or you can rely on the system to choose the one with the shortest idle time. + +``` +$ write nemo#1 +``` + +If the user you are trying to write to has messages blocked, you should see something like this: + +``` +$ write nemo +write: nemo has messages disabled +``` + +### talk/ytalk + +The **talk** or **ytalk** command gives you a chance to have an interactive chat with one or more other users. The command will bring up a double-pane (top and bottom) window. Each individual will type into the top portion of the display on their screen and see the responses in the bottom section(s). The respondents can respond to a talk request by typing "talk" followed by the username of the person addressing them. + +``` +Message from Talk_Daemon@dragonfly at 10:10 ... +talk: connection requested by dory@127.0.0.1. +talk: respond with: talk dory@127.0.0.1 + +$ talk dory +``` + +The window can involve more than two participants if **ytalk** is used. As you can see in the example below (the result of the "talk dory" command shown above), talk is often ytalk. + +``` +----------------------------= YTalk version 3.3.0 =-------------------------- +Is the report ready? + +-------------------------------= nemo@dragonfly =---------------------------- +Just finished it +``` + +As explained above, on the other side of the conversation, the talk session window panes are reversed: + +``` +----------------------------= YTalk version 3.3.0 =-------------------------- +Just finished it + +-------------------------------= dory@dragonfly =---------------------------- +Is the report ready? +``` + +Again, use **^C** to exit. + +To talk with someone on another system, you just need to add a **-h** option and the hostname or IP address with a command like this: + +``` +$ talk -h 192.168.0.11 nemo +``` + +### Wrap-Up + +There are a number of basic commands for sending messages to other logged-in users on Linux systems, and they can be especially useful when you need to send out a quick message to all of the users, prefer a quick exchange to a phone call or want to easily involve more than two people in a quick messaging session. + +Some commands, like **wall**, allow a message to be broadcast, but are not interactive. Others, like **talk**, allow both lengthy and multi-user chats, avoiding the need to set up a conference call when a fairly quick exchange of information is all that's required. + +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/3530343/communicating-with-other-users-on-the-linux-command-line.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/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From 3a7c5ddebdca3241dfe9a8d183a57b87efca477b Mon Sep 17 00:00:00 2001 From: caiichenr <34886864+caiichenr@users.noreply.github.com> Date: Sat, 7 Mar 2020 01:18:03 +0800 Subject: [PATCH 241/260] Update and rename sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md to translated/tech/20190813 Building a non-breaking breakpoint for Python debugging.md --- ...reaking breakpoint for Python debugging.md | 238 ------------------ ...reaking breakpoint for Python debugging.md | 237 +++++++++++++++++ 2 files changed, 237 insertions(+), 238 deletions(-) delete mode 100644 sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md create mode 100644 translated/tech/20190813 Building a non-breaking breakpoint for Python debugging.md diff --git a/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md b/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md deleted file mode 100644 index 0cafd51c17..0000000000 --- a/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md +++ /dev/null @@ -1,238 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (caiichenr) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Building a non-breaking breakpoint for Python debugging) -[#]: via: (https://opensource.com/article/19/8/debug-python) -[#]: author: (Liran Haimovitch https://opensource.com/users/liranhaimovitch) - -Building a non-breaking breakpoint for Python debugging -====== -Have you ever wondered how to speed up a debugger? Here are some lessons -learned while building one for Python. -![Real python in the graphic jungle][1] - -This is the story of how our team at [Rookout][2] built non-breaking breakpoints for Python and some of the lessons we learned along the way. I'll be presenting all about the nuts and bolts of debugging in Python at [PyBay 2019][3] in San Francisco this month. Let's dig in. - -### The heart of Python debugging: sys.set_trace - -There are many Python debuggers out there. Some of the more popular include: - - * **pdb**, part of the Python standard library - * **PyDev**, the debugger behind the Eclipse and PyCharm IDEs - * **ipdb**, the IPython debugger - - - -Despite the range of choices, almost every Python debugger is based on just one function: **sys.set_trace**. And let me tell you, **[sys.settrace][4]** might just be the most complex function in the Python standard library. - -![set_trace Python 2 docs page][5] - -In simpler terms, **settrace** registers a trace function for the interpreter, which may be called in any of the following cases: - - * Function call - * Line execution - * Function return - * Exception raised - - - -A simple trace function might look like this: - - -``` -def simple_tracer(frame, event, arg): -  co = frame.f_code -  func_name = co.co_name -  line_no = frame.f_lineno -  print("{e} {f} {l}".format( -e=event, f=func_name, l=line_no)) -  return simple_tracer -``` - -When looking at this function, the first things that come to mind are its arguments and return values. The trace function arguments are: - - * **frame** object, which is the full state of the interpreter at the point of the function's execution - * **event** string, which can be **call**, **line**, **return**, or **exception** - * **arg** object, which is optional and depends on the event type - - - -The trace function returns itself because the interpreter keeps track of two kinds of trace functions: - - * **Global trace function (per thread):** This trace function is set for the current thread by **sys.settrace** and is invoked whenever a new **frame** is created by the interpreter (essentially on every function call). While there's no documented way to set the trace function for a different thread, you can call **threading.settrace** to set the trace function for all newly created **threading** module threads. - * **Local trace function (per frame):** This trace function is set by the interpreter to the value returned by the global trace function upon frame creation. There's no documented way to set the local trace function once the frame has been created. - - - -This mechanism is designed to allow the debugger to have more granular control over which frames are traced to reduce performance impact. - -### Building our debugger in three easy steps (or so we thought) - -With all that background, writing your own debugger using a custom trace function looks like a daunting task. Luckily, **pdb**, the standard Python debugger, is built on top of **Bdb**, a base class for building debuggers. - -A naive breakpoints debugger based on **Bdb** might look like this: - - -``` -import bdb -import inspect - -class Debugger(bdb.Bdb): -  def __init__(self): -      Bdb.__init__(self) -      self.breakpoints = dict() -      self.set_trace() - -def set_breakpoint(self, filename, lineno, method): -  self.set_break(filename, lineno) -  try : -      self.breakpoints[(filename, lineno)].add(method) -  except KeyError: -      self.breakpoints[(filename, lineno)] = [method] - -def user_line(self, frame): -  if not self.break_here(frame): -      return - -  # Get filename and lineno from frame -  (filename, lineno, _, _, _) = inspect.getframeinfo(frame) - -  methods = self.breakpoints[(filename, lineno)] -  for method in methods: -      method(frame) -``` - -All this does is: - - 1. Inherits from **Bdb** and write a simple constructor initializing the base class and tracing. - 2. Adds a **set_breakpoint** method that uses **Bdb** to set the breakpoint and keeps track of our breakpoints. - 3. Overrides the **user_line** method that is called by **Bdb** on certain user lines. The function makes sure it is being called for a breakpoint, gets the source location, and invokes the registered breakpoints - - - -### How well did the simple Bdb debugger work? - -Rookout is about bringing a debugger-like user experience to production-grade performance and use cases. So, how well did our naive breakpoint debugger perform? - -To test it and measure the global performance overhead, we wrote two simple test methods and executed each of them 16 million times under multiple scenarios. Keep in mind that no breakpoint was executed in any of the cases. - - -``` -def empty_method(): -   pass - -def simple_method(): -   a = 1 -   b = 2 -   c = 3 -   d = 4 -   e = 5 -   f = 6 -   g = 7 -   h = 8 -   i = 9 -   j = 10 -``` - -Using the debugger takes a shocking amount of time to complete. The bad results make it clear that our naive **Bdb** debugger is not yet production-ready. - -![First Bdb debugger results][6] - -### Optimizing the debugger - -There are three main ways to reduce debugger overhead: - - 1. **Limit local tracing as much as possible:** Local tracing is very costly compared to global tracing due to the much larger number of events per line of code. - 2. **Optimize "call" events and return control to the interpreter faster:** The main work in **call** events is deciding whether or not to trace. - 3. **Optimize "line" events and return control to the interpreter faster:** The main work in **line** events is deciding whether or not we hit a breakpoint. - - - -So we forked **Bdb**, reduced the feature set, simplified the code, optimized for hot code paths, and got impressive results. However, we were still not satisfied. So, we took another stab at it, migrated and optimized our code to **.pyx**, and compiled it using [Cython][7]. The final results (as you can see below) were still not good enough. So, we ended up diving into CPython's source code and realizing we could not make tracing fast enough for production use. - -![Second Bdb debugger results][8] - -### Rejecting Bdb in favor of bytecode manipulation - -After our initial disappointment from the trial-and-error cycles of standard debugging methods, we decided to look into a less obvious option: bytecode manipulation. - -The Python interpreter works in two main stages: - - 1. **Compiling Python source code into Python bytecode:** This unreadable (for humans) format is optimized for efficient execution and is often cached in those **.pyc** files we have all come to love. - 2. **Iterating through the bytecode in the _interpreter loop_:** This executes one instruction at a time. - - - -This is the pattern we chose: use **bytecode manipulation** to set **non-breaking breakpoints** with no global overhead. This is done by finding the bytecode in memory that represents the source line we are interested in and inserting a function call just before the relevant instruction. This way, the interpreter does not have to do any extra work to support our breakpoints. - -This approach is not magic. Here's a quick example. - -We start with a very simple function: - - -``` -def multiply(a, b): -   result = a * b -   return result -``` - -In documentation hidden in the **[inspect][9]** module (which has several useful utilities), we learn we can get the function's bytecode by accessing **multiply.func_code.co_code**: - - -``` -`'|\x00\x00|\x01\x00\x14}\x02\x00|\x02\x00S'` -``` - -This unreadable string can be improved using the **[dis][10]** module in the Python standard library. By calling **dis.dis(multiply.func_code.co_code)**, we get: - - -``` -  4          0 LOAD_FAST               0 (a) -             3 LOAD_FAST               1 (b) -             6 BINARY_MULTIPLY     -             7 STORE_FAST              2 (result) - -  5         10 LOAD_FAST               2 (result) -            13 RETURN_VALUE       -``` - -This gets us closer to understanding what happens behind the scenes of debugging but not to a straightforward solution. Unfortunately, Python does not offer a method for changing a function's bytecode from within the interpreter. You can overwrite the function object, but that's not good enough for the majority of real-world debugging scenarios. You have to go about it in a roundabout way using a native extension. - -### Conclusion - -When building a new tool, you invariably end up learning a lot about how stuff works. It also makes you think out of the box and keep your mind open to unexpected solutions. - -Working on non-breaking breakpoints for Rookout has taught me a lot about compilers, debuggers, server frameworks, concurrency models, and much much more. If you are interested in learning more about bytecode manipulation, Google's open source **[cloud-debug-python][11]** has tools for editing bytecode. - -* * * - -_Liran Haimovitch will present "[Understanding Python’s Debugging Internals][12]" at [PyBay][3], which will be held August 17-18 in San Francisco. Use code [OpenSource35][13] for a discount when you purchase your ticket to let them know you found out about the event from our community._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/debug-python - -作者:[Liran Haimovitch][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/liranhaimovitch -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_jungle_lead.jpeg?itok=pFKKEvT- (Real python in the graphic jungle) -[2]: https://rookout.com/ -[3]: https://pybay.com/ -[4]: https://docs.python.org/3/library/sys.html#sys.settrace -[5]: https://opensource.com/sites/default/files/uploads/python2docs.png (set_trace Python 2 docs page) -[6]: https://opensource.com/sites/default/files/uploads/debuggerresults1.png (First Bdb debugger results) -[7]: https://cython.org/ -[8]: https://opensource.com/sites/default/files/uploads/debuggerresults2.png (Second Bdb debugger results) -[9]: https://docs.python.org/2/library/inspect.html -[10]: https://docs.python.org/2/library/dis.html -[11]: https://github.com/GoogleCloudPlatform/cloud-debug-python -[12]: https://pybay.com/speaker/liran-haimovitch/ -[13]: https://ti.to/sf-python/pybay2019/discount/OpenSource35 diff --git a/translated/tech/20190813 Building a non-breaking breakpoint for Python debugging.md b/translated/tech/20190813 Building a non-breaking breakpoint for Python debugging.md new file mode 100644 index 0000000000..aa3a5fa109 --- /dev/null +++ b/translated/tech/20190813 Building a non-breaking breakpoint for Python debugging.md @@ -0,0 +1,237 @@ +[#]: collector: (lujun9972) +[#]: translator: (caiichenr) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a non-breaking breakpoint for Python debugging) +[#]: via: (https://opensource.com/article/19/8/debug-python) +[#]: author: (Liran Haimovitch https://opensource.com/users/liranhaimovitch) + +在 Python 调试过程中设置不中断的断点 +====== +你对如何让调试器变得更快产生过兴趣吗?本文将分享我们在为 Python 构建调试器时得到的一些经验。 +![Real python in the graphic jungle][1] + +整段故事讲的是我们在 [Rookout][2] 公司的团队为 Python 调试器开发不中断断点的经历,以及开发过程中得到的经验。我将在本月于旧金山举办的 [PyBay 2019][3] 上介绍有关 Python 调试过程的更多细节,但现在就让我们立刻开始这段故事。 + +### Python 调试器的心脏:sys.set_trace + +在诸多可选的 Python 调试器中,使用最广泛的三个是: + + * **pdb**,它是 Python 标准库的一部分 + * **PyDev**,它是内嵌在 Eclipse 和 Pycharm 等 IDE 中的调试器 + * **ipdb**,它是IPython的调试器 + + + +Python 调试器的选择虽多,但它们几乎都基于同一个函数:**sys.set_trace**。 值得一提的是, **[sys.settrace][4]** 可能也是 Python 标准库中最复杂的函数。 + +![set_trace Python 2 docs page][5] + +简单来讲,**settrace** 的作用是为解释器注册一个跟踪函数,它在下列四种情形发生时被调用: + + * 函数调用 (Function call) + * 语句执行 (Line execution) + * 函数返回 (Function return) + * 异常抛出 (Exception raised) + + + +一个简单的跟踪函数看上去大概是这样: + + +``` +def simple_tracer(frame, event, arg): +  co = frame.f_code +  func_name = co.co_name +  line_no = frame.f_lineno +  print("{e} {f} {l}".format( +e=event, f=func_name, l=line_no)) +  return simple_tracer +``` + +在分析函数时我们首先关注的是参数和返回值,该跟踪函数的参数分别是: + + * **frame**,当前堆栈帧,它是包含当前函数执行时解释器里完整状态的对象 + * **event**,它是一个值可能为 **"call"**, **"line"**, **"return"**, 或 **"exception"** 的字符串 + * **arg**,它的取值基于 event 的类型,是一个可选项 + + + +该跟踪函数的返回值是它自身,这是由于解释器需要持续跟踪两类跟踪函数: + + * **全局跟踪函数(每线程):** 该跟踪函数由当前线程调用 **sys.settrace** 来设置,并在解释器创建一个新 **frame** 时被调用(即代码中发生函数调用时)。虽然没有现成的方式来为不同的线程设置跟踪函数,但你可以调用 **threading.settrace** 来为所有新创建的 **threading** 模块线程设置跟踪函数。 + * **局部跟踪函数(每一帧):** 解释器将该跟踪函数的值设置为全局跟踪函数创建帧时的返回值。同样也没有现成的方法能够在帧被创建时自动设置局部跟踪函数。 + + + +该机制的目的是让调试器对被跟踪的帧有更精确的把握,以减少对性能的影响。 + +### 简单三步构建调试器 (我们最初的设想) + +仅仅依靠上文提到的内容,用自制的跟踪函数来构建一个真正的调试器似乎有些不切实际。幸运的是,Python 的标准调试器 **pdb** 是基于 **Bdb** 构建的,后者是 Python 标准库中专门用于构建调试器的基类。 + +基于 **Bdb** 的简易断点调试器看上去是这样的: + + +``` +import bdb +import inspect + +class Debugger(bdb.Bdb): +  def __init__(self): +      Bdb.__init__(self) +      self.breakpoints = dict() +      self.set_trace() + +def set_breakpoint(self, filename, lineno, method): +  self.set_break(filename, lineno) +  try : +      self.breakpoints[(filename, lineno)].add(method) +  except KeyError: +      self.breakpoints[(filename, lineno)] = [method] + +def user_line(self, frame): +  if not self.break_here(frame): +      return + +  # Get filename and lineno from frame +  (filename, lineno, _, _, _) = inspect.getframeinfo(frame) + +  methods = self.breakpoints[(filename, lineno)] +  for method in methods: +      method(frame) +``` + +这个调试器类的全部构成是: + + 1. 继承 **Bdb**,定义一个简单的构造函数来初始化基类,并开始跟踪。 + 2. 添加 **set_breakpoint** 方法,它使用 **Bdb** 来设置断点,并跟踪这些断点。 + 3. 重载 **Bdb** 在当前用户行调用的 **user_line** 方法,该方法一定被一个断点调用,之后获取该断点的源位置,并调用已注册的断点。 + + + +### 这个简易的 Bdb 调试器效率如何呢? + +Rookout 的目标是在生产级性能的使用场景下提供接近普通调试器的使用体验。那么,让我们来看看先前构建出来的简易调试器表现的如何。 + +为了衡量调试器的整体性能开销,我们使用如下两个简单的函数来进行测试,它们分别在不同的情景下执行了 1600 万次。请注意,在所有情景下断点都不会被执行。 + + +``` +def empty_method(): +   pass + +def simple_method(): +   a = 1 +   b = 2 +   c = 3 +   d = 4 +   e = 5 +   f = 6 +   g = 7 +   h = 8 +   i = 9 +   j = 10 +``` + +在使用调试器的情况下需要大量的时间才能完成测试。糟糕的结果指明了,这个简陋 **Bdb** 调试器的性能还远不足以在生产环境中使用。 + +![First Bdb debugger results][6] + +### 对调试器进行优化 + +降低调试器的额外开销主要有三种方法: + + 1. **尽可能的限制局部跟踪:** 由于每一行代码都可能包含大量事务,局部跟踪比全局跟踪的开销要大得多。 + 2. **优化 "call" 事务并尽快将控制权还给解释器:** 在 **call** 事务发生时调试器的主要工作是判断是否需要对该事务进行跟踪。 + 3. **优化 "line" 事务并尽快将控制权还给解释器:** 在 **line** 事务发生时调试器的主要工作是判断我们在此处是否需要设置一个断点。 + + + +于是我们克隆了 **Bdb** 项目,精简特征,简化代码,针对使用场景进行优化。这些工作虽然得到了一些效果,但仍无法满足我们的需求。因此我们又继续进行了其它的尝试,将代码优化并迁移至 **.pyx** 使用 [Cython][7] 进行编译,可惜结果(如下图所示)依旧不够理想。最终,我们在深入了解 CPython 源码之后意识到,让跟踪过程快到满足生产需求是不可能的。 + +![Second Bdb debugger results][8] + +### 放弃 Bdb 转而尝试字节码操作 + +熬过先前对标准调试方法进行的试验-失败-再试验循环所带来的失望,我们将目光转向另一种选择:字节码操作。 + +Python 解释器的工作主要分为两个阶段: + + 1. **将Python源码编译成Python字节码:** 这种不可读(对人类而言)的格式专为执行的效率而优化,它们通常缓存在我们熟知的 **.pyc** 文件当中。 + 2. **遍历 _interpreter loop_ 中的字节码:** 在这一步中解释器会逐条的执行指令 + + + +我们选择的模式是:使用 **字节码操作** 来设置没有全局额外开销的 **不中断断点**。 这种方式的实现首先需要在内存中的字节码里找到我们感兴趣的部分,然后在该部分的相关机器指令前插入一个函数调用。如此一来,解释器无需任何额外的工作即可实现我们的不中断断点。 + +这种方法并不依靠魔法来实现,让我们简要地举个例子。 + +首先定义一个简单的函数: + + +``` +def multiply(a, b): +   result = a * b +   return result +``` + +在 **[inspect][9]** 模块(其包含了许多实用的单元)的文档里,我们得知可以通过访问 **multiply.func_code.co_code** 来获取函数的字节码: + + +``` +`'|\x00\x00|\x01\x00\x14}\x02\x00|\x02\x00S'` +``` + +使用 Python 标准库中的 **[dis][10]** 模块可以翻译这些不可读的字符串。调用 **dis.dis(multiply.func_code.co_code)** 之后,我们就可以得到: + + +``` +  4          0 LOAD_FAST               0 (a) +             3 LOAD_FAST               1 (b) +             6 BINARY_MULTIPLY     +             7 STORE_FAST              2 (result) + +  5         10 LOAD_FAST               2 (result) +            13 RETURN_VALUE       +``` + +与直截了当的解决方案相比,这种方法让我们更靠近发生在调试器背后的事情。可惜 Python 并没有提供在解释器中修改函数字节码的方法。我们可以对函数对象进行重写,不过那样做的效率满足不了大多数实际的调试场景。最后我们不得不采用一种迂回的方式来使用原生拓展才能完成这一任务。 + +### 总结 + +在构建一个新工具时,总会学到许多事情的工作原理。这种刨根问底的过程能够使你的思路跳出桎梏,从而得到意料之外的解决方案。 + +在 Rookout 团队中构建不中断断点的这段时间里,我学到了许多有关编译器、调试器、服务器框架、并发模型等等领域的知识。如果你希望更深入的了解字节码操作,谷歌的开源项目 **[cloud-debug-python][11]** 为编辑字节码提供了一些工具。 + +* * * + +_Liran Haimovitch 将于 2019 年八月 17-18 日在旧金山举办的 [PyBay][3] 中发表题为 "[Understanding Python’s Debugging Internals][12]" 的演说,使用 [OpenSource35][13] 可以获得购票优惠,并使他们得知您是在我们的社区得知此事。_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/debug-python + +作者:[Liran Haimovitch][a] +选题:[lujun9972][b] +译者:[caiichenr](https://github.com/caiichenr) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/liranhaimovitch +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_jungle_lead.jpeg?itok=pFKKEvT- (Real python in the graphic jungle) +[2]: https://rookout.com/ +[3]: https://pybay.com/ +[4]: https://docs.python.org/3/library/sys.html#sys.settrace +[5]: https://opensource.com/sites/default/files/uploads/python2docs.png (set_trace Python 2 docs page) +[6]: https://opensource.com/sites/default/files/uploads/debuggerresults1.png (First Bdb debugger results) +[7]: https://cython.org/ +[8]: https://opensource.com/sites/default/files/uploads/debuggerresults2.png (Second Bdb debugger results) +[9]: https://docs.python.org/2/library/inspect.html +[10]: https://docs.python.org/2/library/dis.html +[11]: https://github.com/GoogleCloudPlatform/cloud-debug-python +[12]: https://pybay.com/speaker/liran-haimovitch/ +[13]: https://ti.to/sf-python/pybay2019/discount/OpenSource35 From 225e161672c5cf4f9a5a8cf936dc0044d95ade23 Mon Sep 17 00:00:00 2001 From: caiichenr <34886864+caiichenr@users.noreply.github.com> Date: Sat, 7 Mar 2020 01:23:35 +0800 Subject: [PATCH 242/260] Update 20190813 Building a non-breaking breakpoint for Python debugging.md --- ...Building a non-breaking breakpoint for Python debugging.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20190813 Building a non-breaking breakpoint for Python debugging.md b/translated/tech/20190813 Building a non-breaking breakpoint for Python debugging.md index aa3a5fa109..ed94d222e6 100644 --- a/translated/tech/20190813 Building a non-breaking breakpoint for Python debugging.md +++ b/translated/tech/20190813 Building a non-breaking breakpoint for Python debugging.md @@ -159,12 +159,12 @@ def simple_method(): Python 解释器的工作主要分为两个阶段: - 1. **将Python源码编译成Python字节码:** 这种不可读(对人类而言)的格式专为执行的效率而优化,它们通常缓存在我们熟知的 **.pyc** 文件当中。 + 1. **将 Python 源码编译成 Python 字节码:** 这种不可读(对人类而言)的格式专为执行的效率而优化,它们通常缓存在我们熟知的 **.pyc** 文件当中。 2. **遍历 _interpreter loop_ 中的字节码:** 在这一步中解释器会逐条的执行指令 -我们选择的模式是:使用 **字节码操作** 来设置没有全局额外开销的 **不中断断点**。 这种方式的实现首先需要在内存中的字节码里找到我们感兴趣的部分,然后在该部分的相关机器指令前插入一个函数调用。如此一来,解释器无需任何额外的工作即可实现我们的不中断断点。 +我们选择的模式是:使用**字节码操作**来设置没有全局额外开销的**不中断断点**。这种方式的实现首先需要在内存中的字节码里找到我们感兴趣的部分,然后在该部分的相关机器指令前插入一个函数调用。如此一来,解释器无需任何额外的工作即可实现我们的不中断断点。 这种方法并不依靠魔法来实现,让我们简要地举个例子。 From bf65a2715a2e929b4dc84ac78a21af193214fb58 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 7 Mar 2020 10:29:22 +0800 Subject: [PATCH 243/260] Rename sources/tech/20200306 How I learned about burnout the hard way.md to sources/talk/20200306 How I learned about burnout the hard way.md --- .../20200306 How I learned about burnout the hard way.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200306 How I learned about burnout the hard way.md (100%) diff --git a/sources/tech/20200306 How I learned about burnout the hard way.md b/sources/talk/20200306 How I learned about burnout the hard way.md similarity index 100% rename from sources/tech/20200306 How I learned about burnout the hard way.md rename to sources/talk/20200306 How I learned about burnout the hard way.md From 6c76c528c6dccb307bd354cc9512dd50debd179f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 7 Mar 2020 12:25:12 +0800 Subject: [PATCH 244/260] PRF @geekpi --- ...se logzero for simple logging in Python.md | 61 +++++++------------ 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/translated/tech/20200226 Use logzero for simple logging in Python.md b/translated/tech/20200226 Use logzero for simple logging in Python.md index f246475da4..8ed6bd41e7 100644 --- a/translated/tech/20200226 Use logzero for simple logging in Python.md +++ b/translated/tech/20200226 Use logzero for simple logging in Python.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use logzero for simple logging in Python) @@ -9,23 +9,23 @@ 使用 logzero 在 Python 中进行简单日志记录 ====== -一个方便的日志库快速入门,来帮助你掌握这个重要的编程概念。 -![Snake charmer cartoon with a yellow snake and a blue snake][1] -logzero 库使日志记录就像打印语句一样容易,是简单性的杰出代表。我不确定 logzero 的名称是否要与 pygame-zero、GPIO Zero 和 guizero 这样的 “zero 样板库”契合,但是肯定属于该类别。它是一个 Python 库,使得日志记录变得简单明了。 +> 快速了解一个方便的日志库,来帮助你掌握这个重要的编程概念。 -你可以使用它的基本日志记录到标准输出,就像你可以使用 print 来获得信息和调试一样,它还有学习更高级日志记录(例如记录到文件)的平滑学习曲线。 +![](https://img.linux.net.cn/data/attachment/album/202003/07/122445v743hy7ajdyrrda1.jpg) + +logzero 库使日志记录就像打印语句一样容易,是简单性的杰出代表。我不确定 logzero 的名称是否要与 pygame-zero、GPIO Zero 和 guizero 这样的 “zero 样板库”契合,但是肯定属于该类别。它是一个 Python 库,可以使日志记录变得简单明了。 + +你可以使用它基本的记录到标准输出的日志记录,就像你可以使用 print 来获得信息和调试一样,学习它的更高级日志记录(例如记录到文件)的学习曲线也很平滑。 首先,使用 pip 安装 logzero: - ``` -`$ sudo pip3 install logzero` +$ sudo pip3 install logzero ``` 在 Python 文件中,导入 logger 并尝试以下一个或所有日志实例: - ``` from logzero import logger @@ -39,14 +39,13 @@ logger.error("error") ![Python, Raspberry Pi: import logger][2] -因此现在不要再使用 **print** 来了解发生了什么,而应使用有相关日志级别的 logger。 +因此现在不要再使用 `print` 来了解发生了什么,而应使用有相关日志级别的日志器。 ### 在 Python 中将日志写入文件 如果你阅读至此,并会在你写代码时做一点改变,这对我就足够了。如果你要了解更多,请继续阅读! -写到**标准输出**对于测试新程序不错,但是仅当你登录到运行脚本的计算机时才有用。在很多时候,你需要远程执行代码并在事后查看错误。这种情况下,记录到文件很有帮助。让我们尝试一下: - +写到标准输出对于测试新程序不错,但是仅当你登录到运行脚本的计算机时才有用。在很多时候,你需要远程执行代码并在事后查看错误。这种情况下,记录到文件很有帮助。让我们尝试一下: ``` from logzero import logger, logfile @@ -54,32 +53,28 @@ from logzero import logger, logfile logfile('/home/pi/test.log') ``` -现在,你的日志条目将记录到文件 **test.log** 中。记住确保[脚本有权限] [3]写入该文件及其目录结构。 +现在,你的日志条目将记录到文件 `test.log` 中。记住确保[脚本有权限][3]写入该文件及其目录结构。 你也可以指定更多选项: - ``` -`logfile(’/home/pi/test.log’, maxBytes=1e6, backupCount=3)` +logfile('/home/pi/test.log', maxBytes=1e6, backupCount=3) ``` -现在,当提供给 **logfile** 文件达到 1MB(10^6 字节)时,它将通过 **test.log.1**、**test.log.2** 等文件轮询写入。这种行为可以避免系统打开和关闭大量 I/O 密集的日志文件,以至于系统无法打开和关闭。你或许还要记录到 **/var/log**。假设你使用的是 Linux,那么创建一个目录并将用户设为所有者,以便可以写入该目录: - +现在,当提供给 `test.log` 文件的数据达到 1MB(10^6 字节)时,它将通过 `test.log.1`、`test.log.2` 等文件轮替写入。这种行为可以避免系统打开和关闭大量 I/O 密集的日志文件,以至于系统无法打开和关闭。更专业一点,你或许还要记录到 `/var/log`。假设你使用的是 Linux,那么创建一个目录并将用户设为所有者,以便可以写入该目录: ``` $ sudo mkdir /var/log/test $ sudo chown pi /var/log/test ``` -然后在你的 Python 代码中,更改 **logfile** 路径: - +然后在你的 Python 代码中,更改 `logfile` 路径: ``` -`logfile(’/var/log/test/test.log’, maxBytes=1e6, backupCount=3)` +logfile('/var/log/test/test.log', maxBytes=1e6, backupCount=3) ``` -当要在 **logfile** 中捕获异常时,可以使用 **logging.exception**:。 - +当要在 `logfile` 中捕获异常时,可以使用 `logging.exception`: ``` try: @@ -88,8 +83,7 @@ except Exception as e:     logger.exception(e) ``` -这将输出(在 b 为零的情况下): - +这将输出(在 `b` 为零的情况下): ``` [E 190422 23:41:59 test:9] division by zero @@ -99,8 +93,7 @@ except Exception as e:      ZeroDivisionError: division by zero ``` -你会得到日志,还有完整回溯。另外,你可以使用 **logging.error** 并隐藏回溯: - +你会得到日志,还有完整回溯。另外,你可以使用 `logging.error` 并隐藏回溯: ``` try: @@ -111,28 +104,20 @@ except Exception as e: 现在,将产生更简洁的结果: - ``` -`[E 190423 00:04:16 test:9] ZeroDivisionError: division by zero` +[E 190423 00:04:16 test:9] ZeroDivisionError: division by zero ``` -* * * - -* * * - -* * * - -**![Logging output][4]** +![Logging output][4] 你可以在 [logzero.readthedocs.io] [5] 中阅读更多选项。 ### logzero 为教育而生 -对于新手程序员来说,日志记录可能是一个具有挑战性的概念。大多数框架依赖于流控制和大量变量操作来生成有意义的日志,但是 logzero不同。由于它的语法类似于 print 语句,因此它在教育上很成功,因为它无需解释其他概念。在你的下个项目中试试它。 +对于新手程序员来说,日志记录可能是一个具有挑战性的概念。大多数框架依赖于流控制和大量变量操作来生成有意义的日志,但是 logzero 不同。由于它的语法类似于 `print` 语句,因此它在教育上很成功,因为它无需解释其他概念。在你的下个项目中试试它。 -\-- -_此文章最初发布在[我的博客] [6]上,经许可重新发布。_ +此文章最初发布在[我的博客][6]上,经许可重新发布。 -------------------------------------------------------------------------------- @@ -141,7 +126,7 @@ via: https://opensource.com/article/20/2/logzero-python 作者:[Ben Nuttall][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 5ddf5a770393d7a980caecb7e357102467825ed6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 7 Mar 2020 12:26:15 +0800 Subject: [PATCH 245/260] PUB @geekpi https://linux.cn/article-11970-1.html --- .../20200226 Use logzero for simple logging in Python.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200226 Use logzero for simple logging in Python.md (98%) diff --git a/translated/tech/20200226 Use logzero for simple logging in Python.md b/published/20200226 Use logzero for simple logging in Python.md similarity index 98% rename from translated/tech/20200226 Use logzero for simple logging in Python.md rename to published/20200226 Use logzero for simple logging in Python.md index 8ed6bd41e7..e6bcd095c4 100644 --- a/translated/tech/20200226 Use logzero for simple logging in Python.md +++ b/published/20200226 Use logzero for simple logging in Python.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11970-1.html) [#]: subject: (Use logzero for simple logging in Python) [#]: via: (https://opensource.com/article/20/2/logzero-python) [#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) From d89011fc84938be626099c71a6267789ba505aa4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 8 Mar 2020 00:55:11 +0800 Subject: [PATCH 246/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200308=20The=20?= =?UTF-8?q?De-Googled=20Android=20Fork=20is=20Making=20Good=20Progress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200308 The De-Googled Android Fork is Making Good Progress.md --- ...ed Android Fork is Making Good Progress.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/tech/20200308 The De-Googled Android Fork is Making Good Progress.md diff --git a/sources/tech/20200308 The De-Googled Android Fork is Making Good Progress.md b/sources/tech/20200308 The De-Googled Android Fork is Making Good Progress.md new file mode 100644 index 0000000000..e5d1838cd3 --- /dev/null +++ b/sources/tech/20200308 The De-Googled Android Fork is Making Good Progress.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The De-Googled Android Fork is Making Good Progress) +[#]: via: (https://itsfoss.com/gael-duval-interview/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +The De-Googled Android Fork is Making Good Progress +====== + +A couple years ago, we covered the [Eelo project][1]. If you remember, the Eelo project was started by [Gael Duval][2] who once created Mandrake Linux. The goal of the Eelo project was to remove all Google services from Android to give you an [alternate mobile operating system][3] that doesn’t track you and invade your privacy. + +A lot has happened to Eelo since then. It’s not called Eelo anymore, now it’s called /e/. So, what’s happening with this project? We talked to Gael Duval himself. Here’s what he shared with us. + +![][4] + +_**Why did you create this Eelo or /e/ project in the first place?**_ + +**Gael:** In 2017, I realized that using Android and iPhone, Google and many mobile apps was not compatible with my personal privacy. + +A later study by a US University confirmed this: using an iPhone or and Android phone sends between 6 to 12 MB of personal data to Google servers, daily! And this doesn’t count mobile apps. + +So I looked for reasonable alternatives to iPhone and Android phones but didn’t find any. Either I found options for hobbyists, like Ubuntu Touch, that were not compatible with existing apps and not fully unGoogled either. Or there were alternative ROMs with all the Google fat inside, and no associated basic online services that could be used without tweaking the system. + +Therefore, an idea came to mind: why not fork Android, remove all the Google features, even low level, such as connectivity check, DNS…, replace default apps with more virtuous apps, add basic online services, and integrate all this into a consistent form that could be used by Mum and Dad and any people without tech or expert knowledge? + +_**How is it any different from other custom Android ROMs?**_ + +**Gael:** It doesn’t send a bit of data to Google, and is and will be more and more privacy-focused. + +Low-level: we remove any Android feature that sends data to Google servers. Even the connectivity check when you start the smartphone! To my knowledge, there is not any other Android ROM that does this at the moment. We change default DNS settings and offer users an option to set the DNS of their choice. We change NTP (automatic time configuration) settings to the default NTP servers because there is no reason to use Google NTP servers actually. Then we remove Google services, and we replace with a software layout called microG that can still receive push notifications and have geolocation data for apps (using Mozilla geolocation service). + +Then we change the default apps by non-Google apps, including the maps applications, mail etc., most are open source applications and I can say that there is 99% probability that all will be open source before the end of this year. + +Then we add our own Android application installer, with close to 80 000 available applications at the moment. + +We provide a different web browser, which is a fork of Chromium, were all features that data to Google are removed, and were the default search engine is not Google… + +And we operate online services: + + * search, using a meta-search system that we have improve for a better user experience + * online drive with encrypted data, calendar etc. using a modified version of NextCloud + * mail… + + + +And for we provide a unique identifier that can be used to access all those services, either on the web or from the /e/ OS system, by login once. Then you can sync all your data, calendar, email etc. between your smartphone and your personal /e/ cloud (it can also be self-hosted). +The purpose of the project is to provide a normal, ready to use, and attractive “digital life” to users, without sending all your personal data to Google. + +_**If it is completely ‘ungoogled’, how do users install new apps? Do you have your own app store? If yes, how can we trust that these apps don’t spy on user data?**_ + +**Gael:** Yes – we have our own application installer, with about 80 000 applications. And we analyse each application to unveil the number of trackers, and we display this information to our users, for each application. We are also adding Progressive Web Apps soon to this application installer. + +/e/ OS is about freedom of choice. We want the core system to be better, and then offer as many possible options to users, by informing them as much as possible. In short: they can still any application they need. Next step will be to offer a feature to actually block trackers used in applications. + +_**What is the target user base for /e/? Can an average Joey use it without much trouble?**_ + +![][5] + +**Gael:** We started with tech-savvy users, and we’re expanding the user base to people with less knowledge. At the moment, our typical user base is a mix of tech-savvy users, who can flash a smartphone with /e/ OS and people who are very concerned with Google and their data privacy but have very limited technical knowledge. For those people we have some smartphones pre-installed with /e/ OS for sale, on high-grade refurbished hardware. + +We are also announcing this week an “/e/ easy installer” that will make the flashing process much more easier, by pluging the smartphone to a PC and launching a dedicated application that will make most of the job. + +Then, the next step will be to expand our target users to a more global market, once we find the good partners. But clearly, there is a demand for something different than the Apple-Google worldwide market duopoly on the mobile. + +_**Initially the project was named eelo and it is called /e/ or [e foundation][6]. Personally, I find the name /e/ weird and it is not easily recognizable. Why did you change the project name?**_ + +**Gael:** We have been “attacked” by a company called “eelloo”. They considered that “eelo” would interfere with their business. They are in the HR business solutions, but registered their trademark in all the classes related to mobile OS, smartphones etc. This is silly and a shame, but we had no money to defend us strongly at the time. + +However the/e/ name will be abandonned for something else quite soon. + +_**It’s been a couple of years since the initial launch. How do you see the adoption of /e/?**_ + +**Gael:** We launched the first beta 18 months ago, and we have started to sell smartphones with /e/ a little more than 6 months ago. The adoption is growing a lot at the moment, we have to add terabytes of online storage regularly! + +Also with the /e/ installer arriving, and some official partnerships with some hardware mobile manufacturers in the pipe, this is going to accelerate a lot this year. + +However, this is not surprising, privacy concerns are rising both for individuals and corporations, and I think the rejection of Google is also trending. + +_**What are your future plans to grow /e/?**_ + +**Gael:** The growth is very natural. There is a strong community of users who realize how unique our approach is. These guys are contributing, supporting us and talking a lot about the project. + +With the easy installer coming along and strategic partnerships with hardware makers, this is going to accelerate a lot. + +Also, and this is more personal, I think that there is a natural connection between /e/ OS, and the Linux world. OK, /e/ OS is based on Android, but it’s still a Linux kernel and it’s the same spirit, it’s Open Source… So I’d really like to have more natural integration between my /e/ smartphone and my Linux desktop. There should be some nice features added in this spirit in the next versions of /e/ OS. + +_**What can /e/ users and our readers do to help e foundation?**_ + +**Gael:** Join us, talk about what we are doing, send your feedback, organize some meetups… Help improve the /e/ Wikipedia page which is very poor and doesn’t represent at all what we are actually doing. + +We also have a [permanent crowdfunding campaign where users can support the project financially][7], pay for the servers etc. And, in addition to giving back in term of open source product, we send cool stuff in return :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gael-duval-interview/ + +作者:[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/eelo-mobile-os/ +[2]: https://en.wikipedia.org/wiki/Ga%C3%ABl_Duval +[3]: https://itsfoss.com/open-source-alternatives-android/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/e-os-interview.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/e-foundation-smartphones.jpg?resize=800%2C590&ssl=1 +[6]: https://e.foundation/ +[7]: https://e.foundation/donate/ From 153c6beceb683e3fd7dd0e9ad3cdfda27d2aeec4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 8 Mar 2020 00:56:58 +0800 Subject: [PATCH 247/260] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020200307=20Compos?= =?UTF-8?q?e=20music=20as=20code=20using=20Sonic=20Pi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200307 Compose music as code using Sonic Pi.md --- ...07 Compose music as code using Sonic Pi.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20200307 Compose music as code using Sonic Pi.md diff --git a/sources/tech/20200307 Compose music as code using Sonic Pi.md b/sources/tech/20200307 Compose music as code using Sonic Pi.md new file mode 100644 index 0000000000..6944a5f6ea --- /dev/null +++ b/sources/tech/20200307 Compose music as code using Sonic Pi.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Compose music as code using Sonic Pi) +[#]: via: (https://opensource.com/article/20/3/sonic-pi) +[#]: author: (Matt Bargenquast https://opensource.com/users/mbargenquast) + +Compose music as code using Sonic Pi +====== +There's no need for instrumental mastery with this accessible open +source program that can turn you into a musical virtuoso. +![Bird singing and music notes][1] + +Maybe you're like me, and you learned a musical instrument when you were in school. For me, it was the piano, and later, the viola. However, I've always held that, as my childhood interests shifted towards computers and coding, I subsequently neglected my music practice. I do wonder what I would have done if I'd had something like Sonic Pi when I was younger. Sonic Pi is an open source program that lets you compose and perform music through code itself. It's the perfect marriage of those two worlds. + +Opensource.com is no stranger to Sonic Pi—we [featured an interview][2] with the creator, Dr. Sam Aaron, back in 2015. Since that time, a lot has changed, and Sonic Pi has grown substantially in many ways. It's reached a major new version milestone, with the long-awaited v3.2 release made publically available on February 28, 2020. A growing community of developers is actively contributing to its [GitHub project][3], while an equally thriving community of composers shares ideas and support in the [official forums][4]. The project is now also financially assisted through a [Patreon campaign][5], and Sam himself has been spreading the word of Sonic Pi through schools, conferences, and workshops worldwide. + +What really shines about Sonic Pi is its approachability. Releases are available for many major flavors of OS, including Windows, macOS, Linux, and of course, the Raspberry Pi itself. In fact, getting started with Sonic Pi on a Raspberry Pi couldn't be simpler; it comes pre-installed with [Raspbian][6], so if you have an existing Raspbian-based setup, you'll find it situated in the programming menu. + +Upon loading Sonic Pi for the first time, you'll be greeted with a simple interface with two main areas: an editor in which to write your code, and a section devoted to Sonic Pi's expansive tutorial. For newcomers, the tutorial is an essential resource for learning the basics, featuring accompanying music programs to reinforce each concept being taught. + +If you're following along, let's code ourselves a simple bit of music and explore the potential of live-coding music. Type or paste the following code into the Sonic Pi editor: + + +``` +live_loop :beat do +  sample :drum_heavy_kick +  sleep 1 +end +``` + +Even if you're a Sonic Pi novice, many coders may immediately understand what's going on here. We're playing a drum kick sample, sleeping for a second, and then repeating. Click the Run button or press ALT+R (meta+R on macOS), and you should hear it begin to play. + +This isn't a very exciting song yet, so let's liven it up with a snare playing on the off-beat. Replace the existing code with the block below and Run again. You can leave the existing beat playing while you do this; you'll notice that your changes will be applied naturally, in time with the beat: + + +``` +live_loop :beat do +  sample :drum_heavy_kick +  sleep 0.5 +  sample :drum_snare_soft +  sleep 0.5 +end +``` + +While we're at it, let's add a hi-hat right before every fourth beat, just to make things a little interesting. Add this new block below our existing one and Run again: + + +``` +live_loop :hihat do +  sleep 3.9 +  sample :drum_cymbal_closed +  sleep 0.1 +end +``` + +We've got our beat going now, so let's add a bassline! Sonic Pi comes with a variety of synths built-in, along with effects filters such as reverb and distortion. We'll use a combination of the "dsaw" and "tech_saw" synths to give it an electronic retro-synth feel. Add the block below to your existing program, Run, and have a listen: + + +``` +live_loop :bass do +  use_synth :dsaw +  play :a2, attack: 1, release: 2, amp: 0.3 +  sleep 2.5 +  use_synth :tech_saws +  play :a1, attack: 1, release: 1.5, amp: 0.8 +  sleep 1.5 +end +``` + +You'll note above that we have full control over the [ADSR][7] envelope when playing notes, so we can decide when each sound should peak and fade. + +Lastly, let's add a lead synth and try out one of those effects features known as the "slicer." To spice things up, we'll also introduce an element of pseudo-randomness by letting Sonic Pi pick from a series of potential chords. This is where some of the fun improvisation and "happy accidents" can begin to occur. Add the block below to your existing program and Run: + + +``` +live_loop :lead do +  with_fx :slicer do +    chords = [(chord :A4, :minor7), (chord :A4, :minor), (chord :D4, :minor7), (chord :F4, :major7)] +    use_synth :blade +    play chords.choose, attack: 1, release: 2, amp: 1 +    sleep 2 +  end +end +``` + +Great! Now, we're certainly not going to be competing with Daft Punk any time soon, but hopefully, through this process, you've seen how we can go from a bare beat to something much bigger, in real-time, by adding some simple morsels of code. It is well worth watching one of Sam Aaron's [live coding performances][8] on YouTube for a demonstration of how creative and adaptive Sonic Pi can let you be. + +![Sonic Pi composition example][9] + +Our finished piece, in full + +If you've ever wanted to learn a musical instrument, but felt held back by thoughts like "I don't have rhythm" or "my hands aren't nimble enough," Sonic Pi is a versatile instrument for which none of those things matter. All you need are the ideas, the inspiration, and an inexpensive computer such as the humble Raspberry Pi. The rest is at your fingertips—literally! + +Here are a few handy links to get you started: + + * The Official Sonic Pi [website][10] and [tutorial][11] + * [Getting Started with Sonic Pi][12] ([projects.raspberrypi.org][13]) + * Sonic Pi [Github project][3] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/sonic-pi + +作者:[Matt Bargenquast][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/mbargenquast +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/music-birds-recording-520.png?itok=UoM7brl0 (Bird singing and music notes) +[2]: https://opensource.com/life/15/10/interview-sam-aaron-sonic-pi +[3]: https://github.com/samaaron/sonic-pi/ +[4]: https://in-thread.sonic-pi.net/ +[5]: https://www.patreon.com/samaaron +[6]: https://www.raspberrypi.org/downloads/raspbian/ +[7]: https://en.wikipedia.org/wiki/Envelope_(music) +[8]: https://www.youtube.com/watch?v=JEHpS1aTKp0 +[9]: https://opensource.com/sites/default/files/uploads/sonicpi.png (Sonic Pi composition example) +[10]: https://sonic-pi.net/ +[11]: https://sonic-pi.net/tutorial.html +[12]: https://projects.raspberrypi.org/en/projects/getting-started-with-sonic-pi +[13]: http://projects.raspberrypi.org From f896cec50453a215a71718c47b20859652391dbf Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 8 Mar 2020 09:19:54 +0800 Subject: [PATCH 248/260] Rename sources/tech/20200308 The De-Googled Android Fork is Making Good Progress.md to sources/talk/20200308 The De-Googled Android Fork is Making Good Progress.md --- ...0200308 The De-Googled Android Fork is Making Good Progress.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20200308 The De-Googled Android Fork is Making Good Progress.md (100%) diff --git a/sources/tech/20200308 The De-Googled Android Fork is Making Good Progress.md b/sources/talk/20200308 The De-Googled Android Fork is Making Good Progress.md similarity index 100% rename from sources/tech/20200308 The De-Googled Android Fork is Making Good Progress.md rename to sources/talk/20200308 The De-Googled Android Fork is Making Good Progress.md From c7f406e90bec10e4ad87eb5e78e56e024621558c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Mar 2020 09:50:20 +0800 Subject: [PATCH 249/260] PRF @geekpi --- .../20200302 Install GNU Emacs on Windows.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/translated/tech/20200302 Install GNU Emacs on Windows.md b/translated/tech/20200302 Install GNU Emacs on Windows.md index 3ef9810f0c..c31199d72a 100644 --- a/translated/tech/20200302 Install GNU Emacs on Windows.md +++ b/translated/tech/20200302 Install GNU Emacs on Windows.md @@ -1,41 +1,41 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Install GNU Emacs on Windows) [#]: via: (https://opensource.com/article/20/3/emacs-windows) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -在 Windows 上安装 GNU Emacs +如何在 Windows 上安装 GNU Emacs ====== -即使你的操作系统是闭源的,你仍然可以使用这个流行的开源文本编辑器。 -![Tall building with windows][1] -GNU Emacs 是一个专为各种程序员设计的流行的文本编辑器。因为它是在 Unix 上开发的,并在 Linux(macOS 中也有)上得到了广泛使用,所以人们有时没有意识到它也可用于 Microsoft Windows 上。你也无需成为有经验的或专职的程序员即可使用 Emacs。只需单击几下就可以下载并安装 Emacs,本文向你展示了如何进行。 +> 即使你的操作系统是闭源的,你仍然可以使用这个流行的开源文本编辑器。 + +![](https://img.linux.net.cn/data/attachment/album/202003/08/094942ihwcnsqojnup46wo.jpg) + +GNU Emacs 是一个专为各种程序员设计的流行的文本编辑器。因为它是在 Unix 上开发的,并在 Linux(macOS 中也有)上得到了广泛使用,所以人们有时没有意识到它也可用于微软 Windows 上。你也无需成为有经验的或专职的程序员即可使用 Emacs。只需单击几下就可以下载并安装 Emacs,本文向你展示了如何进行。 你可以手动安装 Windows,也可以使用包管理器安装,例如 [Chocolatey][2]。 ### 7-zip -如果还没在 Windows 中安装 7-zip,那么就先安装它。[7-zip][3] 是一个开源的存档程序,能够创建和解压 ZIP、7z、TAR、XZ、BZIP2 和 GZIP(以及更多)文件。对于 Windows 用户来说,这是一个宝贵的工具。 +如果还没在 Windows 中安装 7-zip,那么就先安装它。[7-zip][3] 是一个开源的归档程序,能够创建和解压 ZIP、7z、TAR、XZ、BZIP2 和 GZIP(以及更多)文件。对于 Windows 用户来说,这是一个宝贵的工具。 -安装 7-zip 后,在 Windows 资源管理器中浏览文件时,右键单击菜单中就有新的 7-zip 存档选项。 +安装 7-zip 后,在 Windows 资源管理器中浏览文件时,右键单击菜单中就有新的 7-zip 归档选项。 ### Powershell 和 Chocolatey 要在 Windows 上使用 Chocolatey 安装 GNU Emacs : - ``` -`PS> choco install emacs-full` +PS> choco install emacs-full ``` 安装后,在 Powershell 中启动 Emacs: - ``` -`PS> emacs` +PS> emacs ``` ![Emacs running on Windows][4] @@ -46,35 +46,35 @@ GNU Emacs 是一个专为各种程序员设计的流行的文本编辑器。因 ![GNU Windows downloader][6] -它会打开连接到离你最近的服务器,并展示所有可用的 Emacs 版本。找到发行版本号最高的目录,然后单击进入。Windows 有许多不同的 Emacs 构建,但是最通用的版本只是被命名为 emacs-VERSION-ARCHITECTURE.zip。**VERSION** 取决于你要下载的版本,而 **ARCHITECTURE** 取决于你使用的是 32 位还是 64 位计算机。大多数现代计算机都是 64 位的,但是如果你有疑问,可以下载 32 位版本,它可在两者上运行。 +它会打开连接到离你最近的服务器,并展示所有可用的 Emacs 版本。找到发行版本号最高的目录,然后单击进入。Windows 有许多不同的 Emacs 构建,但是最通用的版本只是被命名为 `emacs-VERSION-ARCHITECTURE.zip`。`VERSION` 取决于你要下载的版本,而 `ARCHITECTURE` 取决于你使用的是 32 位还是 64 位计算机。大多数现代计算机都是 64 位的,但是如果你有疑问,可以下载 32 位版本,它可在两者上运行。 -如果要下载 64 位计算机的 Emacs v26,你应该点击 emacs-26.2-x86_64.zip 的链接。有较小的下载包(例如 “no-deps” 等),但是你必须熟悉如何从源码构建 Emacs,知道它需要哪些库以及你的计算机上已经拥有哪些库。通常,获取较大版本的 Emacs 最容易,因为它包含了在计算机上运行所需的一切。 +如果要下载 64 位计算机的 Emacs v26,你应该点击 `emacs-26.2-x86_64.zip` 的链接。有较小的下载包(例如 “no-deps” 等),但是你必须熟悉如何从源码构建 Emacs,知道它需要哪些库以及你的计算机上已经拥有哪些库。通常,获取较大版本的 Emacs 最容易,因为它包含了在计算机上运行所需的一切。 ### 解压 Emacs -接下来,解压下载的 ZIP 文件。要解压缩,请右键单击 Emacs ZIP 文件,然后从 7-zip 子菜单中选择 **Extract to Emacs-VERSION**。这是一个很大的压缩包,因此解压可能需要一段时间,但是完成后,你将拥有一个新目录,其中包含与 Emacs 一起分发的所有文件。例如,在此例中,下载了 emacs-26.2-x86_64.zip,因此解压后的目录为 emacs-26.2-x86_64。 +接下来,解压下载的 ZIP 文件。要解压缩,请右键单击 Emacs ZIP 文件,然后从 7-zip 子菜单中选择 “Extract to Emacs-VERSION”。这是一个很大的压缩包,因此解压可能需要一段时间,但是完成后,你将拥有一个新目录,其中包含与 Emacs 一起分发的所有文件。例如,在此例中,下载了 `emacs-26.2-x86_64.zip`,因此解压后的目录为 `emacs-26.2-x86_64`。 ### 启动 Emacs -在 Emacs 目录中,找到 **bin** 目录。此文件夹存储随 Emacs 一起分发的所有二进制可执行文件(EXE 文件)。双击 emacs.exe 文件启动应用。 +在 Emacs 目录中,找到 `bin` 目录。此文件夹存储随 Emacs 一起分发的所有二进制可执行文件(EXE 文件)。双击 `emacs.exe` 文件启动应用。 ![Emacs running on Windows][7] -你可以在桌面上创建 **emacs.exe** 的快捷方式,以便于访问。 +你可以在桌面上创建 `emacs.exe` 的快捷方式,以便于访问。 ### 学习 Emacs Emacs 并不像传闻那样难用。它具有自己的传统和惯例,但是当你其中输入文本时,你可以像在记事本或者网站的文本框中那样使用它。 -重要的区别是在你_编辑_输入的文本时。 +重要的区别是在你*编辑*输入的文本时。 但是,学习的唯一方法是开始使用它,因此,使 Emacs 成为完成简单任务的首选文本编辑器。当你通常打开记事本、Word 或 Evernote 或其他工具来做快速笔记或临时记录时,请启动 Emacs。 Emacs 以基于终端的应用而闻名,但它显然有 GUI,因此请像使用其他程序一样经常使用它的 GUI。从菜单而不是使用键盘复制、剪切和粘贴(paste)(或用 Emacs 的术语 “yank”),然后从菜单或工具栏打开和保存文件。从头开始,并根据应用本身来学习它,而不是根据你以往对其他编辑器的经验就认为它应该是怎样。 -### 下载[速查表][8]! +- 下载[速查表][8]! -_感谢 Matthias Pfuetzner 和 Stephen Smoogen。_ +感谢 Matthias Pfuetzner 和 Stephen Smoogen。 -------------------------------------------------------------------------------- @@ -83,7 +83,7 @@ via: https://opensource.com/article/20/3/emacs-windows 作者:[Seth Kenlon][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 e7bff410bd91b9fd67bd3a64185dd549f4cdd8e9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Mar 2020 09:51:11 +0800 Subject: [PATCH 250/260] PUB @geekpi https://linux.cn/article-11971-1.html --- .../20200302 Install GNU Emacs on Windows.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200302 Install GNU Emacs on Windows.md (98%) diff --git a/translated/tech/20200302 Install GNU Emacs on Windows.md b/published/20200302 Install GNU Emacs on Windows.md similarity index 98% rename from translated/tech/20200302 Install GNU Emacs on Windows.md rename to published/20200302 Install GNU Emacs on Windows.md index c31199d72a..7432b0e600 100644 --- a/translated/tech/20200302 Install GNU Emacs on Windows.md +++ b/published/20200302 Install GNU Emacs on Windows.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11971-1.html) [#]: subject: (Install GNU Emacs on Windows) [#]: via: (https://opensource.com/article/20/3/emacs-windows) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 780b080dc3d469a83ad164348307dfd1770a85c2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Mar 2020 10:10:16 +0800 Subject: [PATCH 251/260] PRF @wxy --- ...g Console Gaming Experience on the Desktop.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md b/translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md index c8d6710e02..7f95da2c67 100644 --- a/translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md +++ b/translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop) @@ -10,7 +10,7 @@ Drauger OS Linux 旨在为台式机带来主机游戏体验 ====== -多年来(或数十年),人们抱怨不[使用Linux][1] 的原因之一是缺乏主流游戏。[Linux 上的游戏][2]在最近几年有了显著改进,特别是 [Steam Proton][3] 项目的引入使你可以[在 Linux 上玩很多 Windows 专用的游戏][4]。 +多年来(或数十年),人们抱怨不[使用Linux][1] 的原因之一是它缺乏主流游戏。[Linux 上的游戏][2]在最近几年有了显著改进,特别是 [Steam Proton][3] 项目的引入使你可以[在 Linux 上玩很多 Windows 专用的游戏][4]。 这也鼓励了一些[以游戏为中心的 Linux发行版][5]。以 [Lakka][6] 为例,你可以[借助 Lakka Linux 将旧计算机变成复古的街机游戏机][7]。 @@ -34,9 +34,9 @@ Drauger OS 开箱即用地安装了多个应用程序和工具,以改善游戏 * Steam * [DXVK][15] -它还具有一组与游戏无关的有趣工具。[Drauger Installer][16] 是 .deb 安装程序,是 Gdebi 的替代品。[多软件库应用安装器][17](mrai)是“用于基于 Debian 的 Linux 操作系统的类似于 AUR-helper 的脚本”。Mrai 旨在与 apt、snap、flatpaks 配合使用,并且可以从 GitHub 安装应用程序。 +它还具有一组与游戏无关的有趣工具。[Drauger 安装器][16]是 .deb 安装程序,是 Gdebi 的替代品。[多软件库应用安装器][17](mrai)是“用于基于 Debian 的 Linux 操作系统的类似于 AUR-helper 的脚本”。Mrai 旨在与 apt、snap、flatpaks 配合使用,并且可以从 GitHub 安装应用程序。 -有趣的是,Drauger OS 的名称是一个错误。首席开发者 [Thomas Castleman][18](即 batcastle)曾打算为其发行版命名为 Draugr,但是却打错了名字。在 Drauger OS 播客的[第 23 集][19]中,Castleman 说保持这个拼写错误的名称,因为要对其进行更正需要大量工作。根据 [Wikipedia][20] 的描述,Draugr 是“来自北欧神话中的不死生物”。 +有趣的是,Drauger OS 的名称是一个错误。开发负责人 [Thomas Castleman][18](即 batcastle)曾打算为其发行版命名为 Draugr,但是却打错了名字。在 Drauger OS 播客的[第 23 集][19]中,Castleman 说会保留这个拼写错误的名称,因为要对其进行更正需要大量工作。根据 [Wikipedia][20] 的描述,Draugr 是“来自北欧神话中的不死生物”。 是的,你没看错。Drauger OS 是仅有的几个具有自己的[播客][21]的发行版之一。当被问到这个问题时,Castleman 告诉我:“无论他们的情况如何,我都希望确保我们的社区拥有最大的透明度。”多数情况下,播客是 Drauger OS 博客的音频版本,但有时他们会在没有时间撰写博客文章时使用它来发布公告。 @@ -44,7 +44,7 @@ Drauger OS 开箱即用地安装了多个应用程序和工具,以改善游戏 ![Drauger OS][22] -Druager OS 背后的开发人员正在开发其下一个主要版本:7.5.1。此版本将基于 Ubuntu 19.10。将有三个主要变化。首先,将使用“我们内部构建的内核” [替换][23] Liquorix 内核。该内核将基于 Linux Kernel GitHub 存储库,“因此,它变得越来越原汁原味”。 +Druager OS 背后的开发人员正在开发其下一个主要版本:7.5.1。此版本将基于 Ubuntu 19.10。将有三个主要变化。首先,将使用“我们内部构建的内核” [替换][23] Liquorix 内核。该内核将基于 Linux 内核 GitHub 存储库,“因此,它会变得越来越原汁原味”。 新版本的第二个主要变化将是为其桌面提供新布局。根据用户的反馈,他们决定将其更改为看起来更类似于 GNOME 的样子。 @@ -93,15 +93,15 @@ via: https://itsfoss.com/drauger-os/ 作者:[John Paul][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/) 荣誉推出 [a]: https://itsfoss.com/author/john/ [b]: https://github.com/lujun9972 [1]: https://itsfoss.com/why-use-linux/ -[2]: https://itsfoss.com/linux-gaming-guide/ -[3]: https://itsfoss.com/steam-play-proton/ +[2]: https://linux.cn/article-7316-1.html +[3]: https://linux.cn/article-10054-1.html [4]: https://itsfoss.com/steam-play/ [5]: https://itsfoss.com/linux-gaming-distributions/ [6]: http://www.lakka.tv/ From 8be4e6b17ec425c7ff3874167dec32b5647008e1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Mar 2020 10:13:40 +0800 Subject: [PATCH 252/260] PUB @wxy https://linux.cn/article-11972-1.html --- ...ims to Bring Console Gaming Experience on the Desktop.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md (99%) diff --git a/translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md b/published/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md similarity index 99% rename from translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md rename to published/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md index 7f95da2c67..d574442156 100644 --- a/translated/tech/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md +++ b/published/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11972-1.html) [#]: subject: (Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop) [#]: via: (https://itsfoss.com/drauger-os/) [#]: author: (John Paul https://itsfoss.com/author/john/) @@ -64,7 +64,7 @@ Drauger OS [系统要求][25]非常适中。请记住,Drauger OS 仅在 64 位 * 图形处理器:集成 * 屏幕分辨率:60Hz 时为 1024×768 * 外部端口:1 个用于显示的端口(HDMI/DisplayPort/VGA/DVI),2 个用于安装 USB 驱动器和键盘的 USB 端口(鼠标可选,但建议使用) -   + #### 推荐系统要求 * CPU:四核、2.2Ghz、64 位处理器 From c566ce0021e4c3ed82f868a0622829cff185c826 Mon Sep 17 00:00:00 2001 From: cycoe Date: Sun, 8 Mar 2020 15:45:35 +0800 Subject: [PATCH 253/260] [Translating] Translating by Cycoe --- .../20190925 Debugging in Emacs- The Grand Unified Debugger.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190925 Debugging in Emacs- The Grand Unified Debugger.md b/sources/tech/20190925 Debugging in Emacs- The Grand Unified Debugger.md index f1a7fe8060..b82a27dadc 100644 --- a/sources/tech/20190925 Debugging in Emacs- The Grand Unified Debugger.md +++ b/sources/tech/20190925 Debugging in Emacs- The Grand Unified Debugger.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (cycoe) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 341de4daa2b9e29667723dc26cc8d42fc214d8a5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Mar 2020 17:50:30 +0800 Subject: [PATCH 254/260] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Fisherman110 恭喜你,完成了第一篇翻译。这篇比较长,内容也稍显晦涩,确实不好翻译。 --- ...80306 Exploring free and open web fonts.md | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/translated/tech/20180306 Exploring free and open web fonts.md b/translated/tech/20180306 Exploring free and open web fonts.md index 605f7514e7..3e688cbd35 100644 --- a/translated/tech/20180306 Exploring free and open web fonts.md +++ b/translated/tech/20180306 Exploring free and open web fonts.md @@ -1,59 +1,57 @@ - -探索免费而开放的网络字体 +探索自由而开放的 Web 字体 ====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-docdish-yellow-typewriter-keys.png?itok=0sPgIdMG) +> 谷歌字体和开放字体库中的免费 Web 字体已经改变了游戏规则,但仅在有限的范围内。 -毫无疑问,近些年来互联网的面貌已经被开放免费的字体所改变。在早些的2010年,你在网络浏览器上几乎只能看到微软制作的最普通的“网络安全字体”[core fonts] -[1]。但这一年(2010)正好是好几轮技术革新开始的见证之年:Web开放字体格式的应用给网络高效传输字体文件提供了一个开放的标准,像[Google Fonts]和 -[Open Font Library]这样的网络字体服务使网络内容发布者在开放证书证书下可以免费使用海量的字体库。 +![](https://img.linux.net.cn/data/attachment/album/202003/08/174910xoklikblgkkbooib.jpg) -要夸大这些网络排印领域大事件的积极影响是很难的。但是要将网络开放字体的成功与开源的网络排印划上等号作为一个整体却非常容易,而且得到的结论是挑战已经远离了我们,困难悉数被解决了。然而事实并非如此,如果你很关注网络字体,好消息是你会有非常多的机会参与到对这些字体的改进工作当中去。 +毫无疑问,近些年来互联网的面貌已经被开源字体所改变。早在 2010 年之前,你在 Web 浏览器上几乎只能看到微软制作的通常“Web 安全”的[核心字体][1]。但这一年(2010)正好是好几轮技术革新开始的见证之年:[Web 开放字体格式][2]Web Open Font Format(WOFF)的引入为通过 HTTP 有效地传输字体文件提供了一个开放的标准,以及像[谷歌字体][3]和[开放字体库][4]Open Font Library这样的 Web 字体服务的推出,使得 Web 内容发布者可以在开源许可证之下免费使用海量的字体库。 -对新手来说,必须要意识到谷歌字体和开源字体库为网页提供了特殊的”服务提供“(service—delivering)字体但是他们给其他使用情况制定字体解决方案。这不是服务方的短视,这是是意味这我们必须去建立其他的解决方案。 +这些事件对 Web 排版的积极影响再夸大都不过分。但是要将 Web 开放字体的成功与整个开源排版等同起来,并得到结论——挑战已经远离了我们,困难悉数被解决了——却很容易。然而事实并非如此,如果你很关注字体,那么好消息是你有好多机会参与到对这些字体的改进工作当中去。 -需要解决的问题还非常多。可能最明显的例子就是给linux桌面机器的其他软件安装字体使用所遇到的尴尬情况。你可以通过任何一种服务下载任何一种网络字体,但是你能得到的是一个最普通的压缩包文件,里面有一些TTF或OTF二进制文件和一个普通文本文件的证书。接下来会发生什么完完全全需要你去猜。 +对新手来说,至关重要的是必须要意识到谷歌字体和开放字体库提供了专用的服务(为网页提供字体),而没有为其他使用情况制定字体解决方案。这不是服务方面的缺点,这只是意味着我们必须去开发其它的解决方案。 -大部分用户很快学会了”正确“的步骤就是手动地复制这些字体二进制文件到他们硬件驱动里一大把的文件夹里的某个文件夹里。但是这样做只能使这个文件被操作系统检索到。它并不能为用户体验带来什么。再强调一遍,这不是网络字体服务的缺陷,然而它是对于关于服务到哪里停止和更多工作需要在其他方面做这个观点的证据。 +需要解决的问题还非常多。可能最明显的例子就是给 Linux 桌面计算机的其他软件安装字体所遇到的尴尬情况。你可以通过任何一种服务下载任何一种 Web 字体,但是你得到的只是一个最普通的压缩包文件,里面有一些 TTF 或 OTF 二进制文件和一个普通文本文件的许可证。接下来会发生什么完完全全需要你去猜。 -在用户视角来说,一个巨大的提升可能就是直接在“下载“这个阶段系统或者桌面环境变得更智能。它(系统或桌面环境)不仅会把字体文件安装到正确的位置上,更重要的是,当用户选择在一个工程使用的字体时,它会自己添加用户所需要得到的重要的元数据。 +大部分用户很快学会了“正确”的步骤就是手动地复制这些字体二进制文件到他们硬盘里几个特殊文件夹里的某一个里。但是这样做只能使这个文件对操作系统可见。它并不能为用户体验带来什么提升。再强调一遍,这不是 Web 字体服务的缺陷,相反它佐证了对于关于服务到哪里停止和需要在其他方面做更多工作的观点。 -附加信息的组成与它如何展示给用户连接着另一个挑战:在linux环境管理一个字体库明显不如任何其他操作系统愉快。字体管理软件总是时不时的出现一下(例如[GTK+ Font Manager][5] 这是最近的一个例子),但是他们(字体管理软件)很少能正确的时候出现。我一直在思考一大堆这些软件让人失望的方面。一个核心的原因是他们把自己限制只展示自己在二进制字体文件内嵌的信息:基本字符集的覆盖,粗细,宽度,和斜度的设定,内置的证书和版权说明等等。 +在用户视角来说,一个巨大的提升可能就是在“只是下载”这个阶段,操作系统或者桌面环境变得更智能。系统或桌面环境不仅会把字体文件安装到正确的位置上,更重要的是,当用户选择要在一个项目中使用的字体时,它会自己添加用户所需要的重要的元数据。 -但是在选择字体的过程中为了工作的选择(字体)都不能在内置数据中找到。正经的字体用户像信息设计者,杂志文章作者,或者书籍美工设计者,他们的字体选择是在每一份文件的需求上做出的。这些需求包含了证书信息,很自然的,它还包含了更多,像关于设计师和厂商的信息,潮流风格的趋势,或者字体在使用当中的细节。 +这些附加信息包含的内容与它如何呈现给用户与另一个挑战有关:与其它操作系统相比,在 Linux 环境管理一个字体库显然不那么令人满意。字体管理器总是时不时的出现一下(例如 [GTK+ 字体管理器][5],这是最近的一个例子),但是它们很少变得流行起来。我一直在思考一大堆这些软件让人失望的方面。一个核心的原因是它们把自己局限于只展示内嵌在二进制字体文件内的信息:基本字符集的覆盖、粗细/宽度和斜率的设定,内置的许可证和版权说明等等。 -举个例子,如果你的文档包含了英语和阿拉伯文,你多半想要一种某个很熟悉拉丁文和阿拉伯文设计师设计同时设计两种语言的字体。否则,你将浪费一大堆时间来微调字体大小和行间距来使两种语言良好地结合在一起。你可能从经验中学到,特定的设计师或服务商(字体)比其他人更善于多语言设计。或许和你职业相关的是今天的时尚杂志几乎无一例外的采用"[Didone][6]"风格的字体,"[Didone][6]"是指一种两百多年前最先被[Firmin Didot][7] 和 [Giambattista Bodoni][8]设计出来的反差超级大的字体风格。这种字体恰好就是现在的潮流。 +但是除了这些内嵌数据中的内容,在选择字体的过程中还涉及很多决策。严肃的字体用户,像信息设计者、杂志文章作者,或者书籍美工设计者,他们的字体选择是根据每一份文件的要求和需求做出的。这当然包含了许可证信息,但它还包含了更多,像关于设计师和厂商的信息、潮流风格的趋势,或者字体在使用中的细节。 -但是这些字体(Didone, Didot, or Bodoni)中没有一种有可能会出现在内置的二进制文件中,你也不容易发现拉丁文和阿拉伯文是否相得益彰或其他关于字体的背后故事。这些信息有可能出现在补充的材料中,类似某种样本或字体文件中,如果这些东西存在的话。 +举个例子,如果你的文档包含了英语和阿拉伯文,你多半想要拉丁文和阿拉伯文的字体由同时熟悉这两种字母系统script的设计师所设计。否则,你将浪费一大堆时间来微调字体大小和行间距来使两种字母系统良好地结合在一起。你可能从经验中学到,某些设计师或字体厂商比其他人更善于多种字母系统设计。或许和你职业相关的是今天的时尚杂志几乎无一例外的采用 “[Didone][6]”风格的字体,“[Didone][6]”是指一种两百多年前最先被 [Firmin Didot][7] 和 [Giambattista Bodoni][8] 设计出来的超高反差的字体风格。这种字体恰好就是现在的潮流。 -字体样本是一份设计好的文档(一般是PDF),它展示了这种字体在使用的情况而且包括了背景信息。字体样本经常起到两重作用,作为市场样本和在挑选字体时的样本。一份样品精心的设计展示了字体在实际应用中的情况和一种自动生产字符表所不能形成的风格。字体样本文件也有可能包含了一些其他重要信息,比如怎样激活字体的开放特色,它提供了什么样的数学表达式和古体字,或者它怎么在跨支持的语言上风格多样。要使这些资源能够被字体管理软件上的用户使用还要走过帮助用户找到合适他们工程的字体的漫长之路。 +但是像 Didone、Didot 或 Bodoni 这些术语都不可能会出现在二进制文件的内置数据当中,你也不容易判断拉丁文和阿拉伯文是否相得益彰或其它关于字体的历史背景。这些信息有可能出现在补充的材料中,类似某种字形样本或字体文件中,如果这些东西存在的话。 -当然,如果我们要去考虑一个字体管理软件能够解决文件和样本问题,我们也必须仔细观察各种发行版提供的字体包伴随着什么。linux的用户刚开始只有自动安装的那几种字体,并且提供仓库的包是大部分用户除了下载最普通的压缩包档案之外的唯一字体来源。这些资源包往往非常的“骨感”。商业字体总的来说都包含了样本,文档,还有其他的支持项目,然而开源字体往往没有(这些配套文件)。 +字形样本specimen是一份设计好的文档(一般是 PDF),它展示了这种字体的使用情况,而且包括了背景信息。字形样本经常在挑选字体时充当市场营销和外观样例的双重角色。一份精心设计的样本展示了字体在实际应用中的情况和在自动生成的字符表中所不能体现的风格。字形样本文件也有可能包含了一些其他重要信息,比如怎样激活字体的 OpenType 特性、提供的数学表达式或古体字,或者它在支持的多种语言上的风格变化。在字体管理应用程序中向用户提供此类材料,对于帮助用户找到适合其项目需求的字体将大有帮助。 -也有一些很棒的开源字体提供了高质量的样本和文档的例子(例如 [SIL Gentium][9] 和 [Bungee][10] 是两种极度不一样但是有效的方案),但是他们几乎不涉足下端的整合包链条。我们肯定能做的(比他们)更好。 +当然,如果我们希望一个字体管理软件能够处理文件和样本问题,我们也必须仔细观察一下各种发行版提供的字体包所随附的内容。Linux 的用户刚开始只有自动安装的那几种字体,并且发行版存储库提供的包是大部分用户除了下载通用的压缩包档案之外的唯一字体来源。这些包往往非常的“简陋”。商业字体总的来说都包含了样本、文档,还有其他的支持项目,然而开源字体往往没有这些配套文件。 -在和系统的字体交互方面提供更丰富的用户体验上面还有一些技术问题。比如说,[AppStream][11]的元数据标准定义了几项针对字体文件的参数,但是现在为止这些参数没有包含样本,设计师和厂商,和其他相关细节的任何信息。另外一个例子,[SPDX][13] (软件包信息交换)格式也没有包含很多软件证书(和证书参数),这些软件证书是用来分配指定字体的。 +也有一些优秀的开放字体提供了高质量的样本和文档(例如 [SIL Gentium][9] 和 [Bungee][10] 是两种差异明显但是都有效的方案),但是它们几乎不涉足下游的打包工作链。我们显然可以做的更好一些。 -最后,就像任何一个唱片爱好者都会告诉你,一个不允许你编辑和完善你的mp3库的ID3信息(mp3头部的一个字节,记录歌手信息)的音乐播放器很快就会变得让人失望。你想要处理标志里的错误,你想要添加比如笔记和乐队,艺术家这样的基本信息,你想要提升你的音乐库。你可能想要做一样的事情来使你的本地字体仓库保持在一个方便使用的状态。 +要在系统的字体交互方面提供更丰富的用户体验上面还存在一些技术问题。一方面,[AppStream][11] 的元数据标准定义了一些字体文件特有的参数,但是到现在为止,这些参数没有包含样本、设计师/厂商和其他相关细节的任何信息。另外一个例子,[SPDX][13](软件包数据交换Software Package Data Exchange)格式也没有包含太多用于分发字体的软件许可证(及许可证变体)。 -但是改动字体文件的内置数据已经被禁止了,因为字体往往是被内置或附加到其他文件里的。如果你拿字体二进制文件来胡闹的话,那么你需要重新为你的展示幻灯片分配字体,任何一个人下载这些幻灯片最终都会面对错误的元数据但他们自己并没有过失。所以任何一个要提升字体管理体验的人都要弄清楚如何来战略的讨论内置或外置的字体元数据里反反复复的变化。 +最后,就像任何一个唱片爱好者都会告诉你的,一个不允许你编辑和完善你的 MP3 曲库中的 ID3 信息的音乐播放器很快就会变得令人失望(LCTT 译注:ID3 信息是 MP3 文件头部的元信息,用于存储歌曲信息)。你想要处理标签里的错误、想要添加注释和专辑封面之类的信息,本质上,这就是完善你的音乐库。同样,你可能也想要让你的本地字体库也保持在一个方便使用的状态。 -除了技术角度之外,丰富字体管理的体验也是一个设计的挑战。就像我前面说的一样,有几种开放的字体也带了良好的样本和精心写好的证明文件。但是有更多的字体包两者都没有,还有大量的更老的字体包已经没有人维护了。这很可能意味着大部分开放字体包想要获得样本和证明文件的唯一办法就是让(字体)社区去为它们创造。 +但是改动字体文件的内置数据一直有所忌讳,因为字体往往是被内置或附加到其他文件里的。如果你随意改变了字体二进制文件中的字段,然后将其与你的演示文稿一起重新分发,那么下载这些演示文稿的任何人最终都会得到错误的元数据,但这个错误不是他们自己造成的。所以任何一个要改善字体管理体验的人都要想明白如何从策略上解决对内置或外置的字体元数据的重复修改。 -可能那(前面说的)是一个很高的要求。但是开源设计社区现在比它以前任何时候都要庞大,并且它(社区)是全面免费开源软件运动中的一个高度活跃的组成部分。所以谁知道呢。可能明年这个时候会发现,在linux桌面系统下载和使用字体会变成一种完全不同的体验。 +除了技术角度之外,丰富的字体管理经验也是一项设计挑战。就像我在前面说的一样,有几种开放字体也带了良好的样本和精心编写的文档。但是更多的字体包这两者都没有,还有大量的更老的字体包已经没有人维护了。这很可能意味着大部分开放字体包想要获得样本和证明文件的唯一办法就是让社区去创建它们。 -在关于现代Linux用户的文字设计上的挑战的一连串思考中包含了打包文件,证明文件设计,甚至有可能需要在桌面环境加入不少新的软件成分。还有其他一连串的东西也需要考虑。共通性就是在网络字体服务不及的地方,事情就变得更加困难。 +也许这是一个很高的要求。但是开源设计社区现在比以往任何时候都要庞大,它是整个自由开源软件运动中的一个高度活跃的组成部分。所以谁知道呢,也许明年这个时候会发现,在 Linux 桌面系统查找、下载和使用字体会变成一种完全不同的体验。 -最好的消息是,从我的视角来看,就是现在比起以前有更多的人对这个议题感兴趣。我认为我们要感谢像谷歌字体和开放字体库这样的网络字体服务巨头让开放字体得到了更高的关注。 +在这一连串关于现代 Linux 用户的文字设计上的挑战的思考中包含了打包、文档设计,甚至有可能需要在桌面环境加入不少新的软件部分。此外还有其他一系列的东西也需要考虑。其共通性就是在 Web 字体服务不可及的地方,事情就会变得更加困难。 +从我的视角来看,最好的消息是现在比起以前有更多的人对这个话题感兴趣。我认为我们要感谢像谷歌字体和开放字体库这样的 Web 字体服务巨头让开放字体得到了更高的关注。 -------------------------------------------------------------------------------- via: https://opensource.com/article/18/3/webfonts 作者:[Nathan Willis][a] -译者:https://github.com/Fisherman110 -校对:[校对者ID](https://github.com/校对者ID) +译者:[Fisherman110](https://github.com/Fisherman110) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 44f232fc2c56d0aed9a8a9b453cddf19af2888d1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 8 Mar 2020 17:51:41 +0800 Subject: [PATCH 255/260] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Fisherman110 本文首发地址:https://linux.cn/article-11974-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/Fisherman110 请注册以领取 LCCN: https://lctt.linux.cn/ --- .../20180306 Exploring free and open web fonts.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180306 Exploring free and open web fonts.md (100%) diff --git a/translated/tech/20180306 Exploring free and open web fonts.md b/published/20180306 Exploring free and open web fonts.md similarity index 100% rename from translated/tech/20180306 Exploring free and open web fonts.md rename to published/20180306 Exploring free and open web fonts.md From fe7ef3c5e8c78ddebb6b1cac9289f90adb63b1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E6=96=B0=E9=98=BF=E5=B2=A9?= <31788564+mengxinayan@users.noreply.github.com> Date: Sun, 8 Mar 2020 06:27:48 -0700 Subject: [PATCH 256/260] Translating File name: 20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md Translator: mengxinayn --- ...sic Vim Commands You Need to Know to Work in Vim Editor.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md b/sources/tech/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md index 657fb6a93b..6b959364b7 100644 --- a/sources/tech/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md +++ b/sources/tech/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (mengxinayan) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -157,7 +157,7 @@ via: https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[萌新阿岩](https://github.com/mengxinayan) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 12a1e0aa16c51981f7b8511f177b897174d65fd8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 9 Mar 2020 08:34:31 +0800 Subject: [PATCH 257/260] translated --- ...ientific calculator for your smartphone.md | 61 ------------------- ...ientific calculator for your smartphone.md | 58 ++++++++++++++++++ 2 files changed, 58 insertions(+), 61 deletions(-) delete mode 100644 sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md create mode 100644 translated/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md diff --git a/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md b/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md deleted file mode 100644 index b69120beaa..0000000000 --- a/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Calculator N+ is an open source scientific calculator for your smartphone) -[#]: via: (https://opensource.com/article/19/11/calculator-n-mobile) -[#]: author: (Ricardo Berlasso https://opensource.com/users/rgb-es) - -Calculator N+ is an open source scientific calculator for your smartphone -====== -The Android app does a wide range of advanced mathematical functions in -the palm of your hand. -![scientific calculator][1] - -Mobile phones are becoming more powerful every day, so it is no surprise that they can beat most computers from the not-so-distant past. This also means the tools available on them are getting more powerful every day. - -Previously, I wrote about [scientific calculators for the Linux desktop][2], and I'm following that up here with information about [Calculator N+][3], an awesome GPL v3.0-licensed computer algebra system (CAS) app for Android devices. - -Calculator N+ is presented as a "powerful calculator for Android," but that's a humble statement; the app not only works with arbitrary precision, displaying results with roots and fractions in all their glory, it does a _lot_ more. - -Finding polynomial roots? Check. Factorization? Check. Symbolic derivatives, integrals, and limits? Check. Number theory (modular arithmetic, combinatorics, prime factorization)? Check. - -You can also solve systems of equations, simplify expressions (including trigonometric ones), convert units… you name it! - -![Calculator N+ graphical interface][4] - -Results are output in LaTeX. The menu in the top-left provides many powerful functions ready to use with a simple touch. Also in that menu, you'll find Help files for all of the app's functions. At the top-right of the screen, you can toggle between exact and decimal representation. Finally, tapping the blue bar at the bottom of the screen gives you access to the whole library of functions available in the app. But be careful! If you are not a mathematician, physicist, or engineer, such a long list may seem overwhelming. - -All of this power comes from the [Symja library][5], another great GPL 3 project. - -Both projects are under active development, and they are getting better with each version. In particular, version 3.4.6 of Calculator N+ gets a major leap in user interface (UI) quality. And yes, there are still some rough corners here and there, but taming this much power in the tiny UI of a smartphone is a difficult task, and I think the app developers are solving its remaining issues quite well. Kudos to them! - -If you are a teacher, a student, or work on a STEM field, check out Calculator N+. It's free, no ads, open source, and covers all your math needs. (Except, of course, during math exams, where smartphones should never be allowed to prevent cheating.) - -Calculator N+ is available in the [Google Play Store][6], or you can [build it from source code][7] using the instructions on the GitHub page. - -If you know any other useful open source apps for science or engineering, let us know in the comments. - -The app makes use of the sensors on your phone and offers a digital science notebook to record your... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/calculator-n-mobile - -作者:[Ricardo Berlasso][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/rgb-es -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c (scientific calculator) -[2]: https://opensource.com/article/18/1/scientific-calculators-linux -[3]: https://github.com/tranleduy2000/ncalc -[4]: https://opensource.com/sites/default/files/uploads/calculatornplus_sqrt-frac.png (Calculator N+ graphical interface) -[5]: https://github.com/axkr/symja_android_library -[6]: https://play.google.com/store/apps/details?id=com.duy.calculator.free -[7]: https://github.com/tranleduy2000/ncalc/blob/master/README.md diff --git a/translated/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md b/translated/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md new file mode 100644 index 0000000000..43d232c6aa --- /dev/null +++ b/translated/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Calculator N+ is an open source scientific calculator for your smartphone) +[#]: via: (https://opensource.com/article/19/11/calculator-n-mobile) +[#]: author: (Ricardo Berlasso https://opensource.com/users/rgb-es) + +Calculator N+ 是一款智能手机上的开源科学计算器 +====== +这个 Android 应用可在掌中计算许多高级数学函数。 +![scientific calculator][1] + +移动电话每天都在变得越来越强大,因此毫不奇怪它们可以击败大多数不太久前的大多数计算机。这也意味着上面的工具每天都在变得越来越强大。 + +之前,我写过一篇 [Linux 桌面上的科学计算器][2],我接着将介绍 [Calculator N +][3],这是一个很棒的 GPL v3.0 许可证下的,适用于 Android 设备的计算机代数系统(CAS)应用。 + +Calculator N+ 被认为是“适用于 Android 的强大计算器”,但这是一个谦虚的说法。它不仅可以以任意精度工作,还可以显示根数和分数等_很多_功能。 + +寻找多项式根?可以。分解因数?可以。导数、积分和极限?可以。数论(模算术、组合学、素因数分解)?可以。 + +你还可以求解系统方程、简化表达式(包括三角函数)、转换单位,只要你想到的,它都能做! + +![Calculator N+ graphical interface][4] + +结果以 LaTeX 输出。左上方的菜单提供了许多强大的功能,只需触摸一下即可使用。同样在该菜单中,你将找到该应用所有功能的帮助文件。在屏幕的右上角,你可以在精确和十进制表示之间切换。最后,点击屏幕底部的蓝色条,即可访问应用中的所有功能库。不过要小心!如果你不是数学家、物理学家或工程师,那么这么长的列表会看上去很震撼。 + +所有这些功能都来自 [Symja 库][5],这是另一个出色的 GPL 3 项目。 + +这两个项目都处于积极开发中,并且每个版本都在不断完善。特别是,Calculator N+ 的 v3.4.6 在用户界面 (UI) 品质方面取得了重大飞跃。但是还是存在一些不好的地方,但是要在智能手机的小巧的用户界面中发挥如此强大的功能是一项艰巨的任务,我认为应用开发人员正在很好地解决其剩余的问题。对他们表示敬意! + +如果你是老师、学生或在理工科领域工作,请试试 Calculator N+。它是免费、无广告、开源的,并可以满足你所有的数学需求。(当然,除了数学考试期间,为防止作弊绝对不允许使用智能手机。) + +可以在 [Google Play 商店][6]找到 Calculator N+,也可以使用 GitHub 页面上的说明[从源代码构建][7]。 + +如果你知道用于科学或工程的其他有用的开源应用,请在评论中告知我们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/calculator-n-mobile + +作者:[Ricardo Berlasso][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/rgb-es +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c (scientific calculator) +[2]: https://opensource.com/article/18/1/scientific-calculators-linux +[3]: https://github.com/tranleduy2000/ncalc +[4]: https://opensource.com/sites/default/files/uploads/calculatornplus_sqrt-frac.png (Calculator N+ graphical interface) +[5]: https://github.com/axkr/symja_android_library +[6]: https://play.google.com/store/apps/details?id=com.duy.calculator.free +[7]: https://github.com/tranleduy2000/ncalc/blob/master/README.md From 062fe204c123755a63b0279043dfa99099bceba7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 9 Mar 2020 08:42:00 +0800 Subject: [PATCH 258/260] translating --- ...clude-Hold-Prevent a Specific Package from an apt Upgrade.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md b/sources/tech/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md index b4e47fcc36..e55c7a24e0 100644 --- a/sources/tech/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md +++ b/sources/tech/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7226419e857261b4bc381a93c0301e5f60d386ac Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Mar 2020 09:15:20 +0800 Subject: [PATCH 259/260] PRF @geekpi --- ...w to Add New Brushes in GIMP -Quick Tip.md | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md b/translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md index 1e43b2bc71..e6e4070e45 100644 --- a/translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md +++ b/translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md @@ -7,10 +7,10 @@ [#]: via: (https://itsfoss.com/add-brushes-gimp/) [#]: author: (Community https://itsfoss.com/author/itsfoss/) -如何在 GIMP 中添加新画笔(快速技巧) +快速技巧:如何在 GIMP 中添加新画笔 ====== -[GIMP][1] 是最流行的免费和开源图像编辑器,它也许是 Linux 上最好的 [Adobe Photoshop 替代品][2]。 +[GIMP][1] 是最流行的自由开源的图像编辑器,它也许是 Linux 上最好的 [Adobe Photoshop 替代品][2]。 当你[在 Ubuntu 或其他任何操作系统上安装了 GIMP 后][3],你会发现已经安装了一些用于基本图像编辑的画笔。如果你需要更具体的画笔,你可以随时在 GIMP 中添加新画笔。 @@ -22,60 +22,59 @@ 在 GIMP 中安装新画笔需要三个步骤: - * 获取新画笔 - * 将其放入指定的文件夹中 - * 刷新 GIMP 中的画笔 - - +* 获取新画笔 +* 将其放入指定的文件夹中 +* 刷新 GIMP 中的画笔 #### 步骤 1:下载新的 GIMP 画笔 第一步是获取新的 GIMP 画笔。你从哪里获取?当然是从互联网上。 -你可以在 Google 或[隐私搜索引擎,如 Duck Duck Go][5] 种搜索 “GIMP画笔”,并从网站下载一个你喜欢的。 +你可以在 Google 或[如 Duck Duck Go 这种隐私搜索引擎][5]来搜索 “GIMP brushes”,并从网站下载一个你喜欢的。 GIMP 画笔通常以 .gbr 和 .gih 文件格式提供。.gbr 文件用于常规画笔,而 .gih 用于动画画笔。 -你知道吗? - -从 2.4 版本起,GIMP 使安装和使用 Photoshop 画笔(.abr 文件)非常简单。你只需将 Photoshop 画笔文件放在正确的文件夹中。 -请记住,最新的 Photoshop 画笔可能无法完美地在 GIMP 中使用。 +> 你知道吗? +> +> 从 2.4 版本起,GIMP 使安装和使用 Photoshop 画笔(.abr 文件)非常简单。你只需将 Photoshop 画笔文件放在正确的文件夹中。 +> +> 请记住,最新的 Photoshop 画笔可能无法完美地在 GIMP 中使用。 #### 步骤 2:将新画笔复制到它的位置 获取画笔文件后,下一步是复制该文件并将其粘贴到 GIMP 配置目录中所在的文件夹。 -在 **Windows** 上,你必须进入类似 “**C:\Documents and Settings\myusername.gimp-2.10\brushes**” 这样的文件夹。 +> 在微软 Windows 上,你必须进入类似 `C:\Documents and Settings\myusername.gimp-2.10\brushes` 这样的文件夹。 -我将展示 **Linux** 上的详细步骤,因为 It’s FOSS 是一个专注于 Linux 的网站。 +我将展示 Linux 上的详细步骤,因为我们是一个专注于 Linux 的网站。 -选择画笔文件后,在 **Home** 目录中按下 **Ctrl+h** [查看 Linux 中的隐藏文件][6]。 +选择画笔文件后,在家目录中按下 `Ctrl+h` [查看 Linux 中的隐藏文件][6]。 ![Press Ctrl+H to see hidden files in the home directory][7] -你应该进入 **.config/GIMP/2.10/brushes** 文件夹(如果你使用的是 GIMP 2.10)。如果使用其他版本,那么应在 .config/GIMP 下看到相应文件夹。 +你应该进入 `.config/GIMP/2.10/brushes` 文件夹(如果你使用的是 GIMP 2.10)。如果使用其他版本,那么应在 `.config/GIMP` 下看到相应文件夹。 ![Adding New Brushes in GIMP][8] -将画笔文件粘贴到此文件夹中。可选地,你可以通过再次按 **Ctrl+h** 来隐藏隐藏的文件。 +将画笔文件粘贴到此文件夹中。可选地,你可以通过再次按 `Ctrl+h` 来隐藏隐藏的文件。 #### 步骤 3:刷新画笔(避免重启 GIMP) GIMP 将在启动时自动加载画笔。如果已在运行,并且不想关闭它,你可以刷新画笔。 -在 GIMP 的主菜单中找到 **Windows**->**Dockable Dialogues**->**Brushes**。 +在 GIMP 的主菜单中找到 “Windows->Dockable Dialogues->Brushes”。 ![Refresh GIMP Brushes by going go to Windows->Dockable Dialogues-> Brushes][9] -在右侧栏的 **Brushes** 对话框中找到**刷新**图标。 +在右侧栏的 Brushes 对话框中找到“refresh”图标。 ![Refresh GIMP Brushes][10] 如果你的画笔没有出现,那么你可以试试重启 GIMP。 -额外的技巧! - -在 [GIMP 中添加新画笔还能让你轻松给图片添加水印][11]。只需将 logo 用作画笔,并点击一下就可添加到图片中。 +> 额外的技巧! +> +> 在 [GIMP 中添加新画笔还能让你轻松给图片添加水印][11]。只需将 logo 用作画笔,并点击一下就可添加到图片中。 我希望你喜欢这个快速 GIMP 技巧。敬请期待更多。 @@ -86,7 +85,7 @@ via: https://itsfoss.com/add-brushes-gimp/ 作者:[Community][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 8a36ebebc3a992bcb2f9e87e2848bb32ab93ac41 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 9 Mar 2020 09:18:08 +0800 Subject: [PATCH 260/260] PUB @geekpi https://linux.cn/article-11975-1.html --- .../20200302 How to Add New Brushes in GIMP -Quick Tip.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20200302 How to Add New Brushes in GIMP -Quick Tip.md (97%) diff --git a/translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md b/published/20200302 How to Add New Brushes in GIMP -Quick Tip.md similarity index 97% rename from translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md rename to published/20200302 How to Add New Brushes in GIMP -Quick Tip.md index e6e4070e45..4608cec762 100644 --- a/translated/tech/20200302 How to Add New Brushes in GIMP -Quick Tip.md +++ b/published/20200302 How to Add New Brushes in GIMP -Quick Tip.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11975-1.html) [#]: subject: (How to Add New Brushes in GIMP [Quick Tip]) [#]: via: (https://itsfoss.com/add-brushes-gimp/) [#]: author: (Community https://itsfoss.com/author/itsfoss/)